Add missing save_config() to config.py (was imported by server.py but never pushed)
This commit is contained in:
+17
-1
@@ -87,4 +87,20 @@ def _deep_merge(base: dict, overrides: dict) -> None:
|
||||
if key in base and isinstance(base[key], dict) and isinstance(val, dict):
|
||||
_deep_merge(base[key], val)
|
||||
else:
|
||||
base[key] = val
|
||||
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
|
||||
Reference in New Issue
Block a user