Run bootstrap seeds in production; add RUN_DEV_SEEDS support
This commit is contained in:
parent
a3e986ae58
commit
d032f1ca0c
5 changed files with 57 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue