refactor ADMIN_{EMAIL,PASSWORD} vars

specify explicitly that they are only used on initial moment (when
loading the initial_datas script)
This commit is contained in:
pedro 2024-03-07 11:13:26 +01:00
parent f5df945d32
commit be2653a50f
3 changed files with 7 additions and 4 deletions

View File

@ -84,8 +84,8 @@ MEDIA_ROOT=/tmp/media/
# DATABASE_URL=postgres://link:to@database:port/idhub
# Defines the admin user after running the initial_datas command
# Defaults to "admin@example.org" if no ADMIN_EMAIL is provided
# ADMIN_EMAIL="idhub_admin@pangea.org"
# Defaults to "admin@example.org" if no INITIAL_ADMIN_EMAIL is provided
# INITIAL_ADMIN_EMAIL="idhub_admin@pangea.org"
# Configures a list of tuples containing names and email addresses of site administrators who should receive error notifications.
ADMINS=[('Admin', 'admin@example.org')]

View File

@ -21,8 +21,8 @@ class Command(BaseCommand):
OIDC_ORGS = settings.OIDC_ORGS
def handle(self, *args, **kwargs):
ADMIN_EMAIL = config('ADMIN_EMAIL', 'admin@example.org')
ADMIN_PASSWORD = config('ADMIN_PASSWORD', '1234')
ADMIN_EMAIL = settings.INITIAL_ADMIN_EMAIL
ADMIN_PASSWORD = settings.INITIAL_ADMIN_PASSWORD
self.create_admin_users(ADMIN_EMAIL, ADMIN_PASSWORD)
if settings.CREATE_TEST_USERS:

View File

@ -42,6 +42,9 @@ assert DOMAIN in ALLOWED_HOSTS, "DOMAIN is not ALLOWED_HOST"
CSRF_TRUSTED_ORIGINS = config('CSRF_TRUSTED_ORIGINS', default=f'https://{DOMAIN}', cast=Csv())
INITIAL_ADMIN_EMAIL = config("INITIAL_ADMIN_EMAIL", default='admin@example.org')
INITIAL_ADMIN_PASSWORD = config("INITIAL_ADMIN_PASSWORD", default='1234')
DEFAULT_FROM_EMAIL = config(
'DEFAULT_FROM_EMAIL', default='webmaster@localhost')