refactor: stop using legacy JSON for runtime config

Build runtime pobsync configuration exclusively from structured SQL
fields, leaving legacy JSON only for import and audit context. Add
SQL-first management commands for global and host configuration and
cover them with tests.
This commit is contained in:
2026-05-19 05:08:37 +02:00
parent a0eb5dcc8f
commit 6d9ddc4457
6 changed files with 231 additions and 45 deletions

View File

@@ -139,6 +139,13 @@ Import existing YAML configs into the database:
python3 manage.py import_pobsync_configs --prefix /opt/pobsync
```
Create SQL-backed configuration directly:
```
python3 manage.py configure_pobsync_global --backup-root /mnt/backups/pobsync
python3 manage.py configure_pobsync_host <host> --address <host-or-ip>
```
Run a backup through Django while still using the existing pobsync engine:
```
@@ -147,7 +154,7 @@ python3 manage.py run_pobsync_backup <host> --prefix /opt/pobsync --prune
The Django backup command reads backup and retention config from SQL directly. Runtime YAML export is kept as a compatibility tool for older CLI flows during the transition.
Export database configs to the runtime YAML files consumed by the current engine:
Export database configs to runtime YAML for legacy CLI compatibility:
```
python3 manage.py export_pobsync_configs --prefix /opt/pobsync
@@ -195,7 +202,7 @@ The MariaDB profile is optional. SQLite remains the default because it is enough
Recommended next steps:
- Continue moving config reading/writing behind repository interfaces so YAML export can eventually disappear.
- Remove remaining legacy YAML-first commands after SQL-first setup covers all workflows.
- Record more engine-side run details into `BackupRun` and `SnapshotRecord`.
- Treat SQL as the source of truth and export YAML only as a compatibility layer for the current engine.
- Run schedules from Django/Docker instead of writing host cron files.