Merge pull request #3017 from betagouv/fix-missing-host-in-email-assets

config: fix email assets not having the full URL domain prepended
This commit is contained in:
Paul Chavard 2018-11-21 13:02:48 +01:00 committed by GitHub
commit b596956761
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -46,6 +46,13 @@ Rails.application.configure do
# Action Mailer settings # Action Mailer settings
config.action_mailer.delivery_method = :letter_opener_web 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 = { Rails.application.routes.default_url_options = {
host: 'localhost', host: 'localhost',

View file

@ -81,10 +81,13 @@ Rails.application.configure do
config.action_mailer.delivery_method = :mailjet config.action_mailer.delivery_method = :mailjet
end end
# Configure default root URL for generating URLs to routes
config.action_mailer.default_url_options = { config.action_mailer.default_url_options = {
protocol: :https, protocol: :https,
host: ENV['APP_HOST'] host: ENV['APP_HOST']
} }
# Configure default root URL for email assets
config.action_mailer.asset_host = "https://" + ENV['APP_HOST']
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found). # the I18n.default_locale when a translation cannot be found).