Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pyoaev/configuration/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get(cls, env_var: str) -> str | None:
:return: value of the env var, or None if not found
:rtype: str | None
"""
return os.getenv(env_var)
return os.getenv(env_var) if env_var else None


class DictionarySource:
Expand All @@ -23,7 +23,7 @@ class DictionarySource:
# this is quite hacky
# it only strictly handles two levels of keys in a dict
@classmethod
def get(cls, config_key_path: list[str], source_dict: dict) -> str | None:
def get(cls, config_key_path: list[str] | None, source_dict: dict) -> str | None:
"""Gets the value for the specified env var

:param config_key_path: the two-level dictionary path to the config key
Expand All @@ -34,6 +34,9 @@ def get(cls, config_key_path: list[str], source_dict: dict) -> str | None:
:return: value for the config key at specified path, or None if not found
:rtype: str | None
"""
if config_key_path is None:
return None

assert (
isinstance(config_key_path, list)
and len(config_key_path) == 2
Expand Down
Loading