diff --git a/pyoaev/configuration/sources.py b/pyoaev/configuration/sources.py index 43a5b88..aeb5385 100644 --- a/pyoaev/configuration/sources.py +++ b/pyoaev/configuration/sources.py @@ -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: @@ -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 @@ -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