diff --git a/README.md b/README.md index 30f13b8..38056d7 100644 --- a/README.md +++ b/README.md @@ -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')] diff --git a/idhub/management/commands/initial_datas.py b/idhub/management/commands/initial_datas.py index dfc0be8..b005dc3 100644 --- a/idhub/management/commands/initial_datas.py +++ b/idhub/management/commands/initial_datas.py @@ -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: diff --git a/trustchain_idhub/settings.py b/trustchain_idhub/settings.py index 53e0f86..f2fdc51 100644 --- a/trustchain_idhub/settings.py +++ b/trustchain_idhub/settings.py @@ -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')