fix: warning
Some checks failed
Checks / check (push) Waiting to run
Build and Push Docker Image / Build and Push Image (push) Failing after 2m1s

This commit is contained in:
Vladimir Rubin 2024-11-29 22:38:42 +02:00
parent 2e2737c6cf
commit 4dedc688cb
Signed by: vavakado
GPG key ID: CAB744727F36B524
3 changed files with 12 additions and 2 deletions

View file

@ -11,9 +11,13 @@ config :exmr,
ecto_repos: [Exmr.Repo],
generators: [timestamp_type: :utc_datetime]
config :exmr,
registration_enabled: "true"
# Configures the endpoint
config :exmr, ExmrWeb.Endpoint,
url: [host: "localhost"],
registration_enabled: "true",
adapter: Bandit.PhoenixAdapter,
render_errors: [
formats: [html: ExmrWeb.ErrorHTML, json: ExmrWeb.ErrorJSON],

View file

@ -6,4 +6,8 @@ defmodule Exmr do
Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others.
"""
def enable_registration do
Application.fetch_env!(:exmr, :registration_enabled)
end
end

View file

@ -3,6 +3,8 @@ defmodule ExmrWeb.Router do
import ExmrWeb.UserAuth
# enable_registration = Application.fetch_env!(:exmr, :registration_enabled)
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
@ -52,7 +54,7 @@ defmodule ExmrWeb.Router do
live_session :redirect_if_user_is_authenticated,
on_mount: [{ExmrWeb.UserAuth, :redirect_if_user_is_authenticated}] do
if Application.get_env(:exmr, :registration_enabled) != "false" do
if Exmr.enable_registration() != "false" do
live "/users/register", UserRegistrationLive, :new
end
@ -69,7 +71,7 @@ defmodule ExmrWeb.Router do
live_session :require_authenticated_user,
on_mount: [{ExmrWeb.UserAuth, :ensure_authenticated}] do
if Application.get_env(:exmr, :registration_enabled) == "false" do
if Exmr.enable_registration() == "false" do
live "/users/register", UserRegistrationLive, :new
end