Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #9 from tfwright/feature/optional-email-config

Ignore missing email configs
  • Loading branch information...
commit 95c283c8decd39aabb1a2a08007fde9274f76af6 2 parents a257dab + 725a542
@alsmola authored
Showing with 13 additions and 10 deletions.
  1. +13 −10 lib/nopassword/engine.rb
View
23 lib/nopassword/engine.rb
@@ -16,7 +16,7 @@ class Engine < ::Rails::Engine
else
ENV['passw3rd-password_file_dir'] = Rails.root.join('config', 'passwords').to_s
ENV['passw3rd-key_file_dir'] = Rails.root.join('config', 'passwords').to_s
- end
+ end
end
initializer "load_helpers" do
@@ -25,15 +25,18 @@ class Engine < ::Rails::Engine
end
initializer "email_settings" do
- APP_CONFIG = YAML.load_file(Rails.root.join('config', 'email.yml'))[Rails.env]
- ActionMailer::Base.smtp_settings = {
- :address => APP_CONFIG["email_server_address"],
- :port => APP_CONFIG["email_port"],
- :domain => APP_CONFIG["email_domain"],
- :user_name => APP_CONFIG["email_username"],
- :password => Passw3rd::PasswordService.get_password('email_password'),
- :authentication => 'plain',
- :enable_starttls_auto => true }
+ MAIL_SETTINGS = YAML.load_file(Rails.root.join('config', 'email.yml'))[Rails.env] rescue nil
+ if MAIL_SETTINGS
+ ActionMailer::Base.smtp_settings = {
+ :address => MAIL_SETTINGS["email_server_address"],
+ :port => MAIL_SETTINGS["email_port"],
+ :domain => MAIL_SETTINGS["email_domain"],
+ :user_name => MAIL_SETTINGS["email_username"],
+ :password => Passw3rd::PasswordService.get_password('email_password'),
+ :authentication => 'plain',
+ :enable_starttls_auto => true
+ }
+ end
end
config.from_email = 'nopassword@alexsmolen.com'
Please sign in to comment.
Something went wrong with that request. Please try again.