diff --git a/apps/transport/lib/transport_web/endpoint.ex b/apps/transport/lib/transport_web/endpoint.ex index 37c3e11afc..afdf20bb9c 100644 --- a/apps/transport/lib/transport_web/endpoint.ex +++ b/apps/transport/lib/transport_web/endpoint.ex @@ -61,19 +61,4 @@ defmodule TransportWeb.Endpoint do plug(Plug.Session, @session_options) plug(TransportWeb.Plugs.Router) - - @doc """ - Callback invoked for dynamically configuring the endpoint. - - It receives the endpoint configuration and checks if - configuration should be loaded from the system environment. - """ - def init(_key, config) do - if config[:load_from_system_env] do - port = System.get_env("PORT") || raise "expected the PORT environment variable to be set" - {:ok, Keyword.put(config, :http, [:inet6, port: port])} - else - {:ok, config} - end - end end diff --git a/config/prod.exs b/config/prod.exs index 559ee16e0b..5e4fd11b1c 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1,15 +1,5 @@ import Config -config :transport, TransportWeb.Endpoint, - http: [port: System.get_env("PORT"), compress: true], - url: [scheme: "https", host: System.get_env("DOMAIN_NAME", "transport.data.gouv.fr"), port: 443], - cache_static_manifest: "priv/static/cache_manifest.json", - secret_key_base: System.get_env("SECRET_KEY_BASE"), - force_ssl: [rewrite_on: [:x_forwarded_proto]], - live_view: [ - signing_salt: System.get_env("SECRET_KEY_BASE") - ] - config :transport, # The key used by Cloak. See `Transport.Vault`. # This value should be base64 encrypted diff --git a/config/runtime.exs b/config/runtime.exs index a21feb0607..38bd3cdb6f 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -223,6 +223,16 @@ if config_env() == :prod do # under "Queue config". For most users, configuring :timeout is enough, as it now includes both queue and query time timeout: 15_000 + config :transport, TransportWeb.Endpoint, + http: [port: System.get_env("PORT"), compress: true], + url: [scheme: "https", host: System.get_env("DOMAIN_NAME"), port: 443], + cache_static_manifest: "priv/static/cache_manifest.json", + secret_key_base: System.get_env("SECRET_KEY_BASE"), + force_ssl: [rewrite_on: [:x_forwarded_proto]], + live_view: [ + signing_salt: System.get_env("SECRET_KEY_BASE") + ] + if app_env == :production do # data.gouv.fr IDs for national databases created automatically and # published by us on data.gouv.fr.