Commit 2fe1732a57427b69bd14628b0d8bbdc30350e463
1 parent
19c83f25
Exists in
master
and in
1 other branch
Allow optional configuration of SMTP settings in config.yml
Showing
2 changed files
with
27 additions
and
8 deletions
Show diff stats
config/config.example.yml
... | ... | @@ -28,16 +28,30 @@ email_at_notices: [1, 10, 100] |
28 | 28 | confirm_resolve_err: true |
29 | 29 | |
30 | 30 | # Add an optional 'username' field to Users. |
31 | -# Helpful if you want to plug in your own authentication strategy. | |
31 | +# Helpful when you need to plug in a custom authentication strategy, such as LDAP. | |
32 | 32 | user_has_username: false |
33 | 33 | |
34 | + | |
35 | +# Configure SMTP settings. If you are running Errbit on Heroku, | |
36 | +# sendgrid will be configured by default. | |
37 | +# ------------------------------------------------------------------------ | |
38 | +#smtp_settings: | |
39 | +# :address: ADDRESS | |
40 | +# :domain: DOMAIN | |
41 | +# :port: "25" | |
42 | +# :authentication: :plain, :login, :cram_md5 | |
43 | +# :enable_starttls_auto: true | |
44 | +# :user_name: USERNAME | |
45 | +# :password: PASSWORD | |
46 | + | |
47 | + | |
34 | 48 | # Configure tracking for Errbit's own internal errors. |
35 | 49 | # There is a central Errbit instance running on heroku, |
36 | 50 | # and other Errbit instances will send their errors there by default. |
37 | -# Please leave this section commented unless you really need to change it. | |
38 | -# ------------------------------------------------------------------------ | |
39 | -# report_self_errors: true | |
40 | -# self_errors_host: errbit-central.heroku.com | |
41 | -# self_errors_port: 80 | |
42 | -# self_errors_api_key: 11e5ce322856e540481e6a0789893179 | |
51 | +# Please leave this section commented if you don't need to override the defaults. | |
52 | +# ------------------------------------------------------------------------------- | |
53 | +#report_self_errors: true | |
54 | +#self_errors_host: errbit-central.heroku.com | |
55 | +#self_errors_port: 80 | |
56 | +#self_errors_api_key: 11e5ce322856e540481e6a0789893179 | |
43 | 57 | ... | ... |
config/initializers/_load_config.rb
... | ... | @@ -12,7 +12,7 @@ if ENV['HEROKU'] |
12 | 12 | Errbit::Config.self_errors_port = ENV['ERRBIT_SELF_ERRORS_PORT'] |
13 | 13 | Errbit::Config.self_errors_api_key = ENV['ERRBIT_SELF_ERRORS_API_KEY'] |
14 | 14 | |
15 | - Errbit::Application.config.action_mailer.smtp_settings = { | |
15 | + Errbit::Config.smtp_settings = { | |
16 | 16 | :address => "smtp.sendgrid.net", |
17 | 17 | :port => "25", |
18 | 18 | :authentication => :plain, |
... | ... | @@ -33,6 +33,11 @@ if File.exists?(config_file) |
33 | 33 | end |
34 | 34 | end |
35 | 35 | |
36 | +# Set SMTP settings if given, but retain defaults if not. | |
37 | +if smtp = Errbit::Config.smtp_settings | |
38 | + Errbit::Application.config.action_mailer.smtp_settings = smtp | |
39 | +end | |
40 | + | |
36 | 41 | # Set config specific values |
37 | 42 | (Errbit::Application.config.action_mailer.default_url_options ||= {}).tap do |default| |
38 | 43 | default.merge! :host => Errbit::Config.host if default[:host].blank? | ... | ... |