Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move mixpanel configuration into the environment. Now we have env'ed …

…all the things
  • Loading branch information...
commit 8fe31188b98e7d9027c9d13554a33b667c149164 1 parent d5f51ec
@practicingruby practicingruby authored
View
14 .env.example
@@ -2,9 +2,7 @@ HOST=localhost:3000
AUTH_MODE=developer
-STRIPE_SECRET_KEY=stripe-secret
-STRIPE_PUBLISHABLE_KEY=stripe-publishable
-STRIPE_WEBHOOK_PATH=/oh/yeah/stripe/webhooks
+
### MailCatcher SMTP ###
@@ -26,6 +24,16 @@ SMTP_PORT = 1025
# SMTP_AUTH = plain
# SMTP_TLS = true
+### Stripe API
+
+STRIPE_SECRET_KEY=stripe-secret
+STRIPE_PUBLISHABLE_KEY=stripe-publishable
+STRIPE_WEBHOOK_PATH=/oh/yeah/stripe/webhooks
+
+### Mixpanel API
+
+MIXPANEL_API_TOKEN=token
+
### Mailchimp API
# MAILCHIMP_LIST_ID=listid
View
1  .gitignore
@@ -4,7 +4,6 @@ log/*.log
tmp/
.rvmrc
config/database.yml
-config/initializers/mixpanel.rb
lib/development_mail_interceptor.rb
.sass-cache/
public/assets
View
2  app/models/tracker.rb
@@ -25,7 +25,7 @@ def update_payment_provider(user)
def initialize(user, params={})
@user = user
- @mixpanel = Mixpanel::Tracker.new(MIXPANEL_API_TOKEN, params)
+ @mixpanel = Mixpanel::Tracker.new(ENV["MIXPANEL_API_TOKEN"], params)
end
def track(event, params={})
View
6 config/deploy.rb
@@ -24,11 +24,7 @@
set :maintenance_config_warning, false
after 'deploy:update_code' do
- { "database.yml" => "config/database.yml",
- "mixpanel.rb" => "config/initializers/mixpanel.rb"}.
- each do |from, to|
- run "ln -nfs #{shared_path}/#{from} #{release_path}/#{to}"
- end
+ run "ln -nfs #{shared_path}/database.yml #{release_path}/config/database.yml"
end
after "deploy", "deploy:migrate"
View
1  config/initializers/mixpanel.rb.example
@@ -1 +0,0 @@
-MIXPANEL_API_TOKEN = "..."
View
23 lib/tasks/setup.rake
@@ -1,25 +1,5 @@
require 'rails_setup'
-namespace :setup do
- desc 'Create initializers from example files'
- setup_task :initializers do
- initializers_dir = Rails.root.join('config', 'initializers')
-
- initializers = %w[mixpanel.rb]
-
- initializers.map! {|f| initializers_dir.join(f) }
-
- initializers.each do |file|
- name = file.basename.to_s
- find_or_create_file(file.to_s, name)
- done name
- end
-
- find_or_create_file("#{Rails.root}/.env", ".env")
- done(".env")
- end
-end
-
desc 'Setup Practicing Ruby for development'
setup_task :setup do
@@ -32,7 +12,8 @@ setup_task :setup do
find_or_create_file(database, "Database config", true)
done "database.yml"
- Rake::Task["setup:initializers"].invoke
+ find_or_create_file("#{Rails.root}/.env", ".env")
+ done(".env")
end
section "Database" do
Please sign in to comment.
Something went wrong with that request. Please try again.