Skip to content

Commit

Permalink
Remove Endpoint deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
simonprev committed Feb 4, 2024
1 parent 6b04632 commit c0c782f
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions lib/accent/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ defmodule Accent.Endpoint do
#
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files in production.
plug(Plug.Static, at: "/static", from: {:accent, "priv/static"}, gzip: true, only: ~w(jipt images))
plug(Plug.Static,
at: "/static",
from: {:accent, "priv/static"},
gzip: true,
only: ~w(jipt images)
)

plug(Plug.Static,
at: "/",
Expand All @@ -29,7 +34,12 @@ defmodule Accent.Endpoint do
plug(Phoenix.CodeReloader)
end

plug(Plug.Session, store: :cookie, key: "accent", signing_salt: "accent-signing-salt-used-for-callback-auth")
plug(Plug.Session,
store: :cookie,
key: "accent",
signing_salt: "accent-signing-salt-used-for-callback-auth"
)

plug(Plug.RequestId)
plug(Plug.Logger)

Expand Down Expand Up @@ -76,21 +86,4 @@ defmodule Accent.Endpoint do

PlugCanonicalHost.call(conn, opts)
end

@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 =
Application.get_env(:accent, Accent.Endpoint)[:http][:port] ||
raise "expected the PORT environment variable to be set"

{:ok, Keyword.put(config, :http, [:inet6, port: port])}
else
{:ok, config}
end
end
end

0 comments on commit c0c782f

Please sign in to comment.