From 742b7b6b645e3d8854bb20000508a4a596001545 Mon Sep 17 00:00:00 2001 From: koko210Serve Date: Wed, 8 Apr 2026 14:14:31 +0300 Subject: [PATCH] fix: persist config_runtime.yaml inside volume-mounted memory dir config_runtime.yaml was written to the container root (/) because the path resolved via Path(__file__).parent.parent from /app/config_manager.py = /. This location is not volume-mounted, so all runtime config changes (language, debug flags, Cheshire Cat toggle, mood, GPU preference) were lost on every container restart. Moved runtime_config_path to memory/config_runtime.yaml, which lives inside the volume-mounted ./bot/memory:/app/memory directory and persists across restarts. Also reordered __init__ so memory_dir is initialized before runtime_config_path depends on it. --- bot/config_manager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot/config_manager.py b/bot/config_manager.py index 3c5fdc0..b644ddd 100644 --- a/bot/config_manager.py +++ b/bot/config_manager.py @@ -35,12 +35,15 @@ class ConfigManager: def __init__(self, config_path: Optional[str] = None): """Initialize configuration manager.""" self.config_path = Path(config_path) if config_path else Path(__file__).parent.parent / "config.yaml" - self.runtime_config_path = Path(__file__).parent.parent / "config_runtime.yaml" # Memory directory for server configs and state + # This directory is volume-mounted in Docker (./bot/memory:/app/memory) self.memory_dir = Path(__file__).parent / "memory" self.memory_dir.mkdir(exist_ok=True) + # Runtime config must live inside memory_dir so it persists across container restarts + self.runtime_config_path = self.memory_dir / "config_runtime.yaml" + # Load configurations self.static_config: Dict = self._load_static_config() self.runtime_config: Dict = self._load_runtime_config()