Commit fd9e06a47d65cdf929fb48d66a7dda2286c107a8

Authored by Damien Mathieu
1 parent d0e1a683
Exists in master and in 1 other branch production

let us use a smtp server other than sendgrid

@@ -157,6 +157,9 @@ heroku addons:add sendgrid:starter @@ -157,6 +157,9 @@ heroku addons:add sendgrid:starter
157 heroku config:add HEROKU=true 157 heroku config:add HEROKU=true
158 heroku config:add ERRBIT_HOST=some-hostname.example.com 158 heroku config:add ERRBIT_HOST=some-hostname.example.com
159 heroku config:add ERRBIT_EMAIL_FROM=example@example.com 159 heroku config:add ERRBIT_EMAIL_FROM=example@example.com
  160 +heroku config:add SMTP_SERVER=smtp.sendgrid.net
  161 +heroku config:add SMTP_USERNAME=the-username-provided-by-sendgrid
  162 +heroku config:add SMTP_PASSWORD=the-password-provided-by-sendgrid
160 git push heroku master 163 git push heroku master
161 ``` 164 ```
162 165
config/initializers/_load_config.rb
@@ -24,12 +24,12 @@ unless defined?(Errbit::Config) @@ -24,12 +24,12 @@ unless defined?(Errbit::Config)
24 Errbit::Config.github_access_scope = ENV['GITHUB_ACCESS_SCOPE'].split(',').map(&:strip) if ENV['GITHUB_ACCESS_SCOPE'] 24 Errbit::Config.github_access_scope = ENV['GITHUB_ACCESS_SCOPE'].split(',').map(&:strip) if ENV['GITHUB_ACCESS_SCOPE']
25 25
26 Errbit::Config.smtp_settings = { 26 Errbit::Config.smtp_settings = {
27 - :address => "smtp.sendgrid.net",  
28 - :port => "25", 27 + :address => ENV['SMTP_SERVER'],
  28 + :port => ENV['SMTP_PORT'] || 25,
29 :authentication => :plain, 29 :authentication => :plain,
30 - :user_name => ENV['SENDGRID_USERNAME'],  
31 - :password => ENV['SENDGRID_PASSWORD'],  
32 - :domain => ENV['SENDGRID_DOMAIN'] 30 + :user_name => ENV['SMTP_USERNAME'],
  31 + :password => ENV['SMTP_PASSWORD'],
  32 + :domain => ENV['ERRBIT_EMAIL_FROM'].split('@').last
33 } 33 }
34 end 34 end
35 35