Skip to content

Commit

Permalink
chore: Remove Skate.Endpoint.init/2, deprecated in Phoenix 1.17.11 (#…
Browse files Browse the repository at this point in the history
…2516)

* chore: Remove Skate.Endpoint.init/2, deprecated in Phoenix 1.17.11

When I [upgraded from Phoenix 1.17.10 to 1.17.11][0], I missed [the
note in the changelog][1] indicating that Endpoint.init/2 was being
deprecated.

It was deprecated in [this commit][2].

[0]: #2393
[1]: https://github.com/phoenixframework/phoenix/blob/main/CHANGELOG.md#deprecation
[2]: phoenixframework/phoenix@5539590#diff-28a3e2f0a9ad390131d7da1927ea8c13c9018a0f5319afe899c32cbeebdf2397R34-R37
  • Loading branch information
joshlarson authored Apr 10, 2024
1 parent bf25cd1 commit 0bb9779
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
1 change: 0 additions & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
15 changes: 0 additions & 15 deletions lib/skate_web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0bb9779

Please sign in to comment.