Respect config file settings for debug - only reset if not set in CLI, env, or config file

parent 13e48496
......@@ -33,27 +33,30 @@ def initialize_config(cli_args=None) -> None:
initial_config = load_initial_config(cli_args)
# Special handling for debug: reset to false unless explicitly set via CLI or env var
# (ignore config file settings to prevent persistent debug from config files)
# Special handling for debug: reset to false unless explicitly set via CLI, env var, or config file
debug_explicitly_set = False
if cli_args and hasattr(cli_args, 'debug') and cli_args.debug:
debug_explicitly_set = True
if f'VIDAI_DEBUG' in os.environ:
elif f'VIDAI_DEBUG' in os.environ:
debug_explicitly_set = True
elif 'debug' in initial_config and initial_config['debug'] != DEFAULTS['debug']:
debug_explicitly_set = True
if not debug_explicitly_set:
# Reset debug to false if not explicitly set via CLI or env
# Reset debug to false if not explicitly set via CLI, env, or config file
initial_config['debug'] = 'false'
# Special handling for debug_web: same logic as debug
debug_web_explicitly_set = False
if cli_args and hasattr(cli_args, 'debug_web') and cli_args.debug_web:
debug_web_explicitly_set = True
if f'VIDAI_DEBUG_WEB' in os.environ:
elif f'VIDAI_DEBUG_WEB' in os.environ:
debug_web_explicitly_set = True
elif 'debug_web' in initial_config and initial_config['debug_web'] != DEFAULTS['debug_web']:
debug_web_explicitly_set = True
if not debug_web_explicitly_set:
# Reset debug_web to false if not explicitly set via CLI or env
# Reset debug_web to false if not explicitly set via CLI, env, or config file
initial_config['debug_web'] = 'false'
# Store all environment variables that start with VIDAI_
......
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