From 8e4ea352c295521c61e8403976f1174e1db8c5eb Mon Sep 17 00:00:00 2001 From: Saverio Trioni Date: Fri, 30 May 2014 21:14:15 +0200 Subject: [PATCH] read smtp configuration from environment --- config/environments/production.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index ebeee31..184c4b2 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -59,15 +59,15 @@ Timeoverflow::Application.configure do protocol: (ENV["MAIL_LINK_PROTO"] || "https") } - # config.action_mailer.smtp_settings = { - # address: ENV['SMTP_ADRESS'], - # port: ENV['SMTP_PORT'], - # domain: ENV['SMTP_DOMAIN'], - # user_name: ENV['SMTP_USER'], - # password: ENV['SMTP_PASSWORD'], - # authentication: :plain, - # enable_starttls_auto: true - # } + smtp_env = Hash[ENV.map do |k,v| + if /^SMTP_(.*)$/ === k + [$1.downcase.to_sym, YAML.load(v)] + end + end.compact] + + if smtp_env.present? + config.action_mailer.smtp_settings = smtp_env + end # Enable threaded mode # config.threadsafe!