Define SMTP configuration in the secrets file

Since SMTP passwords should not be in a file under version control, and
they're usually configured in the production.rb file (which is under
version control), the natural place to configure it is the secrets.yml
file.

Until now we were using the capistrano shared folder, but that's a bit
inconvenient since changes we've done to the production.rb file (like
changing eager_load_paths when we upgraded to Rails 5) won't take effect
after a deployment.
This commit is contained in:
Javi Martín
2019-10-13 01:11:20 +02:00
parent 4b41ccf75d
commit bc9471b49e
5 changed files with 34 additions and 34 deletions

View File

@@ -72,17 +72,11 @@ Rails.application.configure do
config.action_mailer.default_url_options = { host: Rails.application.secrets.server_name }
config.action_mailer.asset_host = "https://#{Rails.application.secrets.server_name}"
# SMTP configuration to deliver emails
# Uncomment the following block of code and add your SMTP service credentials
# config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = {
# address: "smtp.example.com",
# port: 587,
# domain: "example.com",
# user_name: "<username>",
# password: "<password>",
# authentication: "plain",
# enable_starttls_auto: true }
# Configure your SMTP service credentials in secrets.yml
if Rails.application.secrets.smtp_settings
config.action_mailer.delivery_method = Rails.application.secrets.mailer_delivery_method || :smtp
config.action_mailer.smtp_settings = Rails.application.secrets.smtp_settings
end
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).