Add missing save_config() to config.py (was imported by server.py but never pushed)

This commit is contained in:
2026-06-16 17:29:41 -04:00
parent 2c4d7298ec
commit 44f04887dc
+16
View File
@@ -88,3 +88,19 @@ def _deep_merge(base: dict, overrides: dict) -> None:
_deep_merge(base[key], val)
else:
base[key] = val
def save_config(cfg: dict, path: Path = DEFAULT_CONFIG_PATH) -> bool:
"""Save config dict to YAML file (preserves existing keys, overwrites in-memory state).
Returns True on success, False on failure.
"""
try:
import yaml
with open(path, "w") as f:
yaml.dump(cfg, f, default_flow_style=False)
logger.info("Saved config to %s", path)
return True
except (ImportError, OSError) as e:
logger.warning("Failed to save config to %s: %s", path, e)
return False