Skip to content

Commit

Permalink
Only log config if we want it
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbyt3r committed Apr 16, 2024
1 parent 217d3fb commit 4a87730
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sideboard/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,15 @@ def parse_config(requesting_file_path, is_plugin=True):
for config_path in get_config_files(requesting_file_path, is_plugin):
# this gracefully handles nonexistent files
file_config = configobj.ConfigObj(str(config_path), encoding='utf-8', interpolation=False)
print(f"File config for {plugin_name} from {config_path}")
print(json.dumps(file_config, indent=2, sort_keys=True))
if os.environ.get("LOG_CONFIG", "false").lower() == "true":
print(f"File config for {plugin_name} from {config_path}")
print(json.dumps(file_config, indent=2, sort_keys=True))
temp_config.merge(file_config)

environment_config = load_section_from_environment(plugin_name, spec)
print(f"Environment config for {plugin_name}")
print(json.dumps(environment_config, indent=2, sort_keys=True))
if os.environ.get("LOG_CONFIG", "false").lower() == "true":
print(f"Environment config for {plugin_name}")
print(json.dumps(environment_config, indent=2, sort_keys=True))
temp_config.merge(configobj.ConfigObj(environment_config, encoding='utf-8', interpolation=False))

# combining the merge files to one file helps configspecs with interpolation
Expand Down

0 comments on commit 4a87730

Please sign in to comment.