From 323d0f9ca29d744edb705da3cfa275b4adba8389 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum Date: Fri, 9 Aug 2024 12:49:37 +0200 Subject: [PATCH] edit --- dsp_permissions_scripts/models/host.py | 2 +- dsp_permissions_scripts/utils/authentication.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dsp_permissions_scripts/models/host.py b/dsp_permissions_scripts/models/host.py index 175b15e0..7a931251 100644 --- a/dsp_permissions_scripts/models/host.py +++ b/dsp_permissions_scripts/models/host.py @@ -3,7 +3,7 @@ class Hosts: LOCALHOST = "http://0.0.0.0:3333" PROD = "https://api.dasch.swiss" - TEST = "https://api.test.dasch.swiss" + RDU_STAGE = "https://api.rdu-stage.dasch.swiss" DEV = "https://api.dev.dasch.swiss" LS_PROD = "https://api.ls-prod.admin.ch" STAGE = "https://api.stage.dasch.swiss" diff --git a/dsp_permissions_scripts/utils/authentication.py b/dsp_permissions_scripts/utils/authentication.py index ebd2e732..0c93bae9 100644 --- a/dsp_permissions_scripts/utils/authentication.py +++ b/dsp_permissions_scripts/utils/authentication.py @@ -1,4 +1,5 @@ import os +import re from dotenv import load_dotenv @@ -14,9 +15,12 @@ def _get_login_credentials(host: str) -> tuple[str, str]: if host == Hosts.LOCALHOST: user = "root@example.com" pw = "test" - elif host == Hosts.TEST: - user = os.getenv("TEST_EMAIL") or "" - pw = os.getenv("TEST_PASSWORD") or "" + elif host == Hosts.RDU_STAGE: + user = os.getenv("RDU_STAGE_EMAIL") or "" + pw = os.getenv("RDU_STAGE_PASSWORD") or "" + elif re.search(r"api.rdu-\d\d.dasch.swiss", host): + user = os.getenv("RDU_TEST_EMAIL") or "" + pw = os.getenv("RDU_TEST_PASSWORD") or "" elif host == Hosts.DEV: user = os.getenv("DEV_EMAIL") or "" pw = os.getenv("DEV_PASSWORD") or ""