Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Commit

Permalink
Move Mailer settings to initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
joegatt committed Aug 29, 2013
1 parent 8acf7d9 commit 5c6f812
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 56 deletions.
16 changes: 8 additions & 8 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ class Application < Rails::Application
config.assets.enabled = true

# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.assets.version = '1.1'

# Generators
config.generators do |g|
g.test_framework :rspec,
:fixtures => true,
:view_specs => false,
:helper_specs => false,
:routing_specs => false,
:controller_specs => true,
:request_specs => true
g.fixture_replacement :factory_girl, :dir => "spec/factories"
fixtures: true,
view_specs: false,
helper_specs: false,
routing_specs: false,
controller_specs: true,
request_specs: true
g.fixture_replacement :factory_girl, dir: "spec/factories"
end
end
end
16 changes: 0 additions & 16 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,5 @@
# Expands the lines which load the assets
config.assets.debug = true

# Mailer
# If we put these in application.rb, Settings is not read.
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: Settings.mailer.address,
port: Settings.mailer.port,
domain: Settings.mailer.domain,
user_name: Secret.mailer.user_name,
password: Secret.mailer.password,
authentication: 'plain',
enable_starttls_auto: true
}
config.action_mailer.default_url_options = {
host: Settings.host
}

config.eager_load = false
end
17 changes: 1 addition & 16 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# Compress JavaScripts and CSS
config.assets.compress = true
config.assets.js_compressor = :uglify

# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
Expand Down Expand Up @@ -61,21 +62,5 @@
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify

# Mailer
# If we put these in application.rb, Settings is not read.
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: Settings.mailer.address,
port: Settings.mailer.port,
domain: Settings.mailer.domain,
user_name: Secret.mailer.user_name,
password: Secret.mailer.password,
authentication: 'plain',
enable_starttls_auto: true
}
config.action_mailer.default_url_options = {
host: Settings.host
}

config.eager_load = true
end
17 changes: 1 addition & 16 deletions config/environments/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# Compress JavaScripts and CSS
config.assets.compress = true
config.assets.js_compressor = :uglify

# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
Expand Down Expand Up @@ -64,21 +65,5 @@
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify

# Mailer
# If we put these in application.rb, Settings is not read.
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: Settings.mailer.address,
port: Settings.mailer.port,
domain: Settings.mailer.domain,
user_name: Secret.mailer.user_name,
password: Secret.mailer.password,
authentication: 'plain',
enable_starttls_auto: true
}
config.action_mailer.default_url_options = {
host: Settings.host
}

config.eager_load = true
end
11 changes: 11 additions & 0 deletions config/initializers/mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ActionMailer::Base.smtp_settings = {
address: Settings.mailer.address,
port: Settings.mailer.port,
domain: Settings.mailer.domain,
user_name: Secret.mailer.user_name,
password: Secret.mailer.password,
authentication: 'plain',
enable_starttls_auto: true
}

ActionMailer::Base.default_url_options[:host] = Settings.host

0 comments on commit 5c6f812

Please sign in to comment.