Differentiate Bandit port between test and other envs

This commit is contained in:
Adrian Gruntkowski 2025-02-07 14:47:54 +01:00
parent e388cf5af5
commit 8cc9355286
2 changed files with 5 additions and 1 deletions

View file

@ -2,6 +2,10 @@ import Config
config :jenot, host: System.fetch_env!("HOST")
port = if config_env() == :test, do: 4001, else: 4000
config :jenot, port: port
config :jenot, secret_key_base: System.fetch_env!("SECRET_KEY_BASE")
config :jenot, secure_cookie: System.fetch_env!("SECURE_COOKIE") == "true"

View file

@ -9,7 +9,7 @@ defmodule Jenot.Application do
children = [
Jenot.Repo,
{Bandit, plug: Jenot.Web, scheme: :http, port: 4000}
{Bandit, plug: Jenot.Web, scheme: :http, port: Application.fetch_env!(:jenot, :port)}
]
opts = [strategy: :one_for_one, name: Jenot.Supervisor]