Run bootstrap seeds in production; add RUN_DEV_SEEDS support
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/promote/production Build is passing

This commit is contained in:
Moritz 2026-03-09 15:10:50 +01:00
parent a3e986ae58
commit d032f1ca0c
Signed by: moritz
GPG key ID: 1020A035E5DD0824
5 changed files with 57 additions and 4 deletions

View file

@ -1,6 +1,15 @@
# Bootstrap seeds: run in all environments (dev, test, prod).
# Creates only data required for system startup: fee types, custom fields,
# roles, admin user, system user, global settings. No members, no groups.
#
# Safe to run from release (no Mix): env is taken from MIX_ENV when Mix.env/0 is not available.
mix_env =
try do
Mix.env()
rescue
UndefinedFunctionError -> (System.get_env("MIX_ENV") || "prod") |> String.to_atom()
end
alias Mv.Accounts
alias Mv.Membership
@ -121,7 +130,7 @@ end
admin_email = System.get_env("ADMIN_EMAIL") || "admin@localhost"
System.put_env("ADMIN_EMAIL", admin_email)
if Mix.env() in [:dev, :test] and is_nil(System.get_env("ADMIN_PASSWORD")) and
if mix_env in [:dev, :test] and is_nil(System.get_env("ADMIN_PASSWORD")) and
is_nil(System.get_env("ADMIN_PASSWORD_FILE")) do
System.put_env("ADMIN_PASSWORD", "testpassword")
end