Skip to content

Commit

Permalink
use different configs for development and production
Browse files Browse the repository at this point in the history
  • Loading branch information
rkononov committed Sep 20, 2012
1 parent ec7d0fc commit 46a535f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Expand Up @@ -2,6 +2,6 @@ class ApplicationController < ActionController::Base
protect_from_forgery protect_from_forgery


def client def client
IW_CLIENT Rails.application.config.iw_client
end end
end end
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <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 %> <%= csrf_meta_tags %>


<!-- Le HTML5 shim, for IE6-8 support of HTML elements --> <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
Expand Down
2 changes: 2 additions & 0 deletions config/application.rb
Expand Up @@ -59,6 +59,8 @@ class Application < Rails::Application
# Version of your assets, change this if you want to expire all your assets # Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0' config.assets.version = '1.0'
config2 = YAML.load_file(File.join(Rails.root, "config_#{Rails.env}.yml")) 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 = config.action_mailer.smtp_settings =
{ {
:address => config2['address'], :address => config2['address'],
Expand Down
4 changes: 1 addition & 3 deletions config/initializers/iron_worker.rb
@@ -1,7 +1,5 @@
puts "Initializing IronWorker"
IW_CLIENT = IronWorkerNG::Client.new
puts "Creating worker from worker file" puts "Creating worker from worker file"
code_from_workerfile = IronWorkerNG::Code::Base.new(:workerfile => 'workers/simple_mailer_worker.worker') code_from_workerfile = IronWorkerNG::Code::Base.new(:workerfile => 'workers/simple_mailer_worker.worker')
puts "Uploading worker" puts "Uploading worker"
IW_CLIENT.codes.create(code_from_workerfile) Rails.application.config.iw_client.codes.create(code_from_workerfile)
puts "Worker uploaded" puts "Worker uploaded"
4 changes: 4 additions & 0 deletions config_development.yml
Expand Up @@ -4,3 +4,7 @@ domain: domain.com
user_name: system@domain.com user_name: system@domain.com
password: strongPass password: strongPass


iron:
token: ZJI9lHPkA********************
project_id: 50**********************

0 comments on commit 46a535f

Please sign in to comment.