config: fix email assets not having the full URL domain prepended

When sending emails, the mailer doesn't have access to the request
host. It needs to infer it by itself.

For this we need two settings:

- action_mailer.default_url_options, to generate urls to routes
- action_mailer.asset_host, to generate full urls to assets

Only the first one of these settings was set in production.

Fix #2518
This commit is contained in:
Pierre de La Morinerie 2018-11-21 11:28:13 +00:00
parent 37af20b236
commit ac9a87f27b
2 changed files with 10 additions and 0 deletions

View file

@ -46,6 +46,13 @@ Rails.application.configure do
# Action Mailer settings
config.action_mailer.delivery_method = :letter_opener_web
# Configure default root URL for generating URLs to routes
config.action_mailer.default_url_options = {
host: 'localhost',
port: 3000
}
# Configure default root URL for email assets
config.action_mailer.asset_host = "http://" + ENV['APP_HOST']
Rails.application.routes.default_url_options = {
host: 'localhost',