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.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user