From 890f6303f6288798628bced79edbc31e14f8fd51 Mon Sep 17 00:00:00 2001 From: vermaas <vermaas@astron.nl> Date: Tue, 7 Feb 2023 13:17:17 +0100 Subject: [PATCH] make KEYCLOAK_URL an env var --- atdb/atdb/settings/base.py | 9 +++++++-- atdb/atdb/settings/dev.py | 9 --------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/atdb/atdb/settings/base.py b/atdb/atdb/settings/base.py index 34afccd7..aa823d9d 100644 --- a/atdb/atdb/settings/base.py +++ b/atdb/atdb/settings/base.py @@ -222,10 +222,15 @@ AUTHENTICATION_BACKENDS = [ "allauth.account.auth_backends.AuthenticationBackend", ] +try: + KEYCLOAK_URL = os.environ['KEYCLOAK_URL'] +except: + KEYCLOAK_URL = 'https://sdc-dev.astron.nl/auth' + SOCIALACCOUNT_PROVIDERS = { 'keycloak': { - 'KEYCLOAK_URL': 'https://sdc-dev.astron.nl/auth', # replace by https://keycloak.astron.nl/auth for production - 'KEYCLOAK_REALM': 'SDC', # change this depending on which realm to use + 'KEYCLOAK_URL': KEYCLOAK_URL, + 'KEYCLOAK_REALM': 'SDC', 'SCOPE': ['openid', 'profile', 'email'] } } diff --git a/atdb/atdb/settings/dev.py b/atdb/atdb/settings/dev.py index 8c9925a1..a3f0a997 100644 --- a/atdb/atdb/settings/dev.py +++ b/atdb/atdb/settings/dev.py @@ -24,13 +24,4 @@ DATABASES = { AUTH_PASSWORD_VALIDATORS = [] -# astronauth settings -SOCIALACCOUNT_PROVIDERS = { - 'keycloak': { - 'KEYCLOAK_URL': 'https://sdc-dev.astron.nl/auth', # replace by https://keycloak.astron.nl/auth for production - 'KEYCLOAK_REALM': 'SDC', # change this depending on which realm to use - 'SCOPE': ['openid', 'profile', 'email'] - } -} - LOGIN_REDIRECT_URL = "http://localhost:8000/atdb" -- GitLab