Commit 426291e5 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed problem with env config vars.

parent 5efd12d3
Pipeline #94727 passed with stages
in 23 minutes and 38 seconds
...@@ -342,7 +342,13 @@ def _apply(key, value, raise_error: bool = True) -> None: ...@@ -342,7 +342,13 @@ def _apply(key, value, raise_error: bool = True) -> None:
leading to ``config.fs.staging``. leading to ``config.fs.staging``.
''' '''
full_key = key full_key = key
group_key, config_key = full_key.split('_', 1) try:
group_key, config_key = full_key.split('_', 1)
except Exception:
if raise_error:
logger.error(f'config key does not exist: {full_key}')
return
current = globals() current = globals()
if group_key not in current: if group_key not in current:
......
...@@ -51,6 +51,9 @@ def test_apply(with_config, caplog): ...@@ -51,6 +51,9 @@ def test_apply(with_config, caplog):
config._apply('max_entry_download', 'not_a_number') config._apply('max_entry_download', 'not_a_number')
assert_log(caplog, 'ERROR', 'cannot set') assert_log(caplog, 'ERROR', 'cannot set')
config._apply('nounderscore', 'test_value')
assert_log(caplog, 'ERROR', 'nounderscore does not exist')
def test_env(with_config, monkeypatch): def test_env(with_config, monkeypatch):
monkeypatch.setattr('os.environ', dict(NOMAD_FS_PUBLIC='test_value')) monkeypatch.setattr('os.environ', dict(NOMAD_FS_PUBLIC='test_value'))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment