fix(config): never autosave defaults over an unreadable config file

Additional changes
The migration copies the old file to the backup instead of moving it and replaces the file atomically, only after the migration succeeded.
An explicit save keeps a copy of a file that could not be loaded and serializes the configuration before it opens the file.
The configuration guide describes the migration backup and what happens to a file that cannot be loaded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
Christin
2026-11-20 18:39:14 +01:00
committed by Bobby Noelte
co-authored by Claude Opus 5.5
parent 887bae551b
commit f3773de8f8
5 changed files with 236 additions and 32 deletions
+11
View File
@@ -98,6 +98,17 @@ found, a default configuration file is created, and the default settings are wri
location of the created configuration file follows the same order in which EOS searches for
configuration files, and it depends on whether the relevant environment variables are set.
A configuration file of an older EOS version is migrated to the current version. The old file is
kept as a backup next to it (`EOS.config.<timestamp>`). If the migration fails, the file is left
as it is.
If the configuration file cannot be loaded, e.g. because of a JSON syntax error or a failed
migration, EOS logs an error and runs with the default configuration. It then does not save the
configuration automatically, so the defaults never replace the file. Fix the file and reload it
with `POST /v1/config/reset` or a restart of EOS. `PUT /v1/config/file` saves the current
configuration anyway; it keeps a copy of the file that could not be loaded as
`EOS.config.unreadable.<timestamp>`.
Use the following endpoints to interact with the configuration file:
- `PUT /v1/config/file`: Save the current configuration to the configuration file.