Permalink
Browse files

use different configs for development and production

  • Loading branch information...
1 parent ec7d0fc commit 46a535fafa3fd6432689ead9166bce114eeb6063 @rkononov rkononov committed Sep 20, 2012
View
2 app/controllers/application_controller.rb
@@ -2,6 +2,6 @@ class ApplicationController < ActionController::Base
protect_from_forgery
def client
- IW_CLIENT
+ Rails.application.config.iw_client
end
end
View
2 app/views/layouts/application.html.erb
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title><%= content_for?(:title) ? yield(:title) : "App" %></title>
+ <title><%= content_for?(:title) ? yield(:title) : "IronWorker Rails101 example" %></title>
<%= csrf_meta_tags %>
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
View
2 config/application.rb
@@ -59,6 +59,8 @@ class Application < Rails::Application
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config2 = YAML.load_file(File.join(Rails.root, "config_#{Rails.env}.yml"))
+ puts "Initializing IronWorker for #{Rails.env} environment"
+ config.iw_client = IronWorkerNG::Client.new(:token => config2['iron']['token'], :project_id => config2['iron']['project_id'])
config.action_mailer.smtp_settings =
{
:address => config2['address'],
View
4 config/initializers/iron_worker.rb
@@ -1,7 +1,5 @@
-puts "Initializing IronWorker"
-IW_CLIENT = IronWorkerNG::Client.new
puts "Creating worker from worker file"
code_from_workerfile = IronWorkerNG::Code::Base.new(:workerfile => 'workers/simple_mailer_worker.worker')
puts "Uploading worker"
-IW_CLIENT.codes.create(code_from_workerfile)
+Rails.application.config.iw_client.codes.create(code_from_workerfile)
puts "Worker uploaded"
View
4 config_development.yml
@@ -4,3 +4,7 @@ domain: domain.com
user_name: system@domain.com
password: strongPass
+iron:
+ token: ZJI9lHPkA********************
+ project_id: 50**********************
+

0 comments on commit 46a535f

Please sign in to comment.