fix(server): only require DASHBOARD_PASSWORD_HASH in prod

Blocking bootstrap in dev meant you couldn't even run 'mix run' to
generate the initial hash. Now dev/test accept an optional env override
and boot without it; prod still raises when unset.
This commit is contained in:
Carsten 2026-04-21 22:59:24 +02:00
parent 2f787ec31f
commit fe7b07db4f
3 changed files with 3977 additions and 1 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
import Config
if config_env() in [:prod, :dev] do
if config_env() == :prod do
hash =
System.get_env("DASHBOARD_PASSWORD_HASH") ||
raise """
@ -10,6 +10,12 @@ if config_env() in [:prod, :dev] do
"""
config :server, :dashboard_password_hash, hash
else
# dev/test: accept an env var override, otherwise leave unset.
# Dev boot without it will crash only when someone POSTs /login.
if hash = System.get_env("DASHBOARD_PASSWORD_HASH") do
config :server, :dashboard_password_hash, hash
end
end
# config/runtime.exs is executed for all environments, including