fix bug
This commit is contained in:
@@ -28,7 +28,12 @@ class ConfigStore:
|
||||
|
||||
raw = self._file_path.read_text(encoding="utf-8")
|
||||
data = json.loads(raw) if raw.strip() else {}
|
||||
return AppConfig.model_validate(data)
|
||||
cfg = AppConfig.model_validate(data)
|
||||
# Auto-fill newly introduced config keys.
|
||||
normalized = cfg.model_dump(mode="json")
|
||||
if normalized != data:
|
||||
self._write_unlocked(cfg)
|
||||
return cfg
|
||||
|
||||
async def save(self, cfg: AppConfig) -> None:
|
||||
async with self._lock:
|
||||
|
||||
Reference in New Issue
Block a user