From 2dd77d61cebeee2f6866601802f5f4750fa2085f Mon Sep 17 00:00:00 2001 From: Robusta Runner Date: Sun, 23 Jun 2024 15:52:51 +0300 Subject: [PATCH] Update config.py --- holmes/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/holmes/config.py b/holmes/config.py index 9f9089b..a43ef23 100644 --- a/holmes/config.py +++ b/holmes/config.py @@ -272,6 +272,7 @@ 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 + # prevent unset cli options from overriding defaults (when there is no config file) cli_options = { k: v for k, v in kwargs.items() if v is not None and v != [] } @@ -280,7 +281,7 @@ def load_from_file(cls, config_file: Optional[str], **kwargs) -> "Config": return config_from_cli merged_config = config_from_file.dict() - # remove Nones to avoid overriding config file with empty cli args + # prevent unset cli options from overriding the config file settings cli_overrides = { k: v for k, v in config_from_cli.dict().items() if v is not None and v != [] }