Make sure session cookie salt in AuthController is loaded dynamically

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-09-21 10:16:07 +02:00
parent 6675c62d94
commit 88b4f98c41
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -11,7 +11,7 @@ defmodule Mobilizon.Web.AuthController do
plug(Plug.Session, plug(Plug.Session,
store: :cookie, store: :cookie,
key: "_auth_callback", key: "_auth_callback",
signing_salt: Keyword.get(endpoint_config, :secret_key_base) signing_salt: {Mobilizon.Web.AuthController, :secret_key_base, []}
) )
plug(Ueberauth) plug(Ueberauth)
@ -141,7 +141,9 @@ defmodule Mobilizon.Web.AuthController do
redirect(conn, to: "/login?code=Error with Login Provider&provider=#{provider_name}") redirect(conn, to: "/login?code=Error with Login Provider&provider=#{provider_name}")
end end
defp endpoint_config do def secret_key_base do
Application.get_env(:mobilizon, Mobilizon.Web.Endpoint, []) :mobilizon
|> Application.get_env(Mobilizon.Web.Endpoint, [])
|> Keyword.get(:secret_key_base)
end end
end end