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