diff --git a/config/dev.exs b/config/dev.exs index 57630ea6b..e15a5c6fa 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -24,7 +24,6 @@ config :skate, SkateWeb.Endpoint, debug_errors: true, code_reloader: true, check_origin: false, - secret_key_base: "local_secret_key_base_at_least_64_bytes_________________________________", watchers: [ node: [ "node_modules/webpack/bin/webpack.js", diff --git a/config/runtime.exs b/config/runtime.exs index 0c4c25552..7195a2875 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -5,12 +5,15 @@ Application.ensure_all_started(:hackney) Application.ensure_all_started(:ex_aws) config :skate, - secret_key_base: System.get_env("SECRET_KEY_BASE"), restrict_environment_access?: System.get_env("RESTRICT_ENVIRONMENT_ACCESS") == "true", base_tileset_url: System.get_env("BASE_TILESET_URL"), satellite_tileset_url: System.get_env("SATELLITE_TILESET_URL"), aws_place_index: System.get_env("AWS_PLACE_INDEX") +if System.get_env("SECRET_KEY_BASE") do + config :skate, SkateWeb.Endpoint, secret_key_base: System.get_env("SECRET_KEY_BASE") +end + config :skate, Skate.OpenRouteServiceAPI, api_base_url: System.get_env("OPEN_ROUTE_SERVICE_API_URL"), api_key: System.get_env("OPEN_ROUTE_SERVICE_API_KEY"), diff --git a/lib/skate_web/endpoint.ex b/lib/skate_web/endpoint.ex index af29b600b..4cf7cb122 100644 --- a/lib/skate_web/endpoint.ex +++ b/lib/skate_web/endpoint.ex @@ -46,19 +46,4 @@ defmodule SkateWeb.Endpoint do signing_salt: "jkUgGkwy" plug SkateWeb.Router - - # callback for runtime configuration - def init(:supervisor, config) do - secret_key_base = Application.get_env(:skate, :secret_key_base) - - config = - if secret_key_base do - Keyword.put(config, :secret_key_base, secret_key_base) - else - config[:secret_key_base] || raise "No SECRET_KEY_BASE ENV var!" - config - end - - {:ok, config} - end end