From 045bd35938b0dc4b8a8f84041dfcecaa8d172932 Mon Sep 17 00:00:00 2001 From: Natan Yellin Date: Sun, 23 Jun 2024 15:39:23 +0300 Subject: [PATCH] Prevent unset cli options from overriding defaults (#60) --- holmes/config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/holmes/config.py b/holmes/config.py index 02a491e..9f9089b 100644 --- a/holmes/config.py +++ b/holmes/config.py @@ -272,7 +272,10 @@ def load_from_file(cls, config_file: Optional[str], **kwargs) -> "Config": logging.debug("No config file found, using cli settings only") config_from_file = None - config_from_cli = cls(**kwargs) + cli_options = { + k: v for k, v in kwargs.items() if v is not None and v != [] + } + config_from_cli = cls(**cli_options) if config_from_file is None: return config_from_cli