Refactor: use APP_HOST env variable in development env

It prevents exceptions when APP_HOST is custom in development env.

*** ArgumentError Exception: Missing host to link to! Please provide the
   :host parameter, set default_url_options[:host], or set :only_path to
   true
This commit is contained in:
François Vantomme 2021-03-11 11:38:51 +01:00 committed by Pierre de La Morinerie
parent 2be40cf432
commit 0758e2d1cf

View file

@ -77,15 +77,12 @@ Rails.application.configure do
# Action Mailer settings
config.action_mailer.delivery_method = :letter_opener
config.action_mailer.default_url_options = {
host: 'localhost',
port: 3000
}
config.action_mailer.asset_host = "http://" + ENV['APP_HOST']
config.action_mailer.default_url_options = { host: ENV.fetch("APP_HOST") }
config.action_mailer.asset_host = "http://" + ENV.fetch("APP_HOST")
Rails.application.routes.default_url_options = {
host: 'localhost',
port: 3000
host: ENV.fetch("APP_HOST"),
protocol: :http
}
# Use Content-Security-Policy-Report-Only headers
@ -111,4 +108,6 @@ Rails.application.configure do
if ENV['IGN_CARTE_REFERER']
config.hosts << ENV['IGN_CARTE_REFERER']
end
config.hosts << ENV.fetch("APP_HOST")
end