Commit 04eaf4f0434ef02439b6a32a20c6e7c7a772baf1
1 parent
05dc0040
Exists in
master
and in
1 other branch
Use sendgrid as default email service, but allow developers to override SMTP set…
…tings with SMTP_* vars
Showing
2 changed files
with
5 additions
and
8 deletions
Show diff stats
README.md
| @@ -157,9 +157,6 @@ heroku addons:add sendgrid:starter | @@ -157,9 +157,6 @@ 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 | ||
| 163 | git push heroku master | 160 | git push heroku master |
| 164 | ``` | 161 | ``` |
| 165 | 162 |
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 => ENV['SMTP_SERVER'], | ||
| 28 | - :port => ENV['SMTP_PORT'] || 25, | 27 | + :address => ENV['SMTP_SERVER'] || 'smtp.sendgrid.net', |
| 28 | + :port => ENV['SMTP_PORT'] || 25, | ||
| 29 | :authentication => :plain, | 29 | :authentication => :plain, |
| 30 | - :user_name => ENV['SMTP_USERNAME'], | ||
| 31 | - :password => ENV['SMTP_PASSWORD'], | ||
| 32 | - :domain => ENV['ERRBIT_EMAIL_FROM'].split('@').last | 30 | + :user_name => ENV['SMTP_USERNAME'] || ENV['SENDGRID_USERNAME'], |
| 31 | + :password => ENV['SMTP_PASSWORD'] || ENV['SENDGRID_PASSWORD'], | ||
| 32 | + :domain => ENV['SENDGRID_DOMAIN'] || ENV['ERRBIT_EMAIL_FROM'].split('@').last | ||
| 33 | } | 33 | } |
| 34 | end | 34 | end |
| 35 | 35 |