Skip to content

Commit

Permalink
implement constants through envs
Browse files Browse the repository at this point in the history
  • Loading branch information
nilupulmanodya committed Nov 11, 2023
1 parent faa974e commit 8d9d00c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mslib/mscolab/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ class setup_saml2_backend:
# }
# },
]
# Setting up the path from environment variables to settings is only for testing purposes
mscolab_settings.MSCOLAB_SSO_DIR = os.getenv("TESTING_MSCOLAB_SSO_DIR", mscolab_settings.MSCOLAB_SSO_DIR)
mscolab_settings.USE_SAML2 = bool(os.getenv("TESTING_USE_SAML2", mscolab_settings.USE_SAML2))

if os.path.exists(f"{mscolab_settings.MSCOLAB_SSO_DIR}/mss_saml2_backend.yaml"):
with open(f"{mscolab_settings.MSCOLAB_SSO_DIR}/mss_saml2_backend.yaml", encoding="utf-8") as fobj:
yaml_data = yaml.safe_load(fobj)
Expand Down
5 changes: 5 additions & 0 deletions tests/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@
# we keep DATA_DIR until we move netCDF4 files to pyfilesystem2
DATA_DIR = DATA_FS.getsyspath("")

# set MSCOLAB_SSO_DIR through envs
MSCOLAB_SSO_DIR = os.path.join(os.path.expanduser("~"), 'testingdatasso')
os.environ['TESTING_MSCOLAB_SSO_DIR'] = MSCOLAB_SSO_DIR

# set TESTING_USE_SAML2 through envs
os.environ['TESTING_USE_SAML2'] = "True"

# deployed mscolab url
MSCOLAB_URL = "http://localhost:8083"
Expand Down

0 comments on commit 8d9d00c

Please sign in to comment.