`qfs -migrate` теперь применяет только migrations/*.sql (встроены в бинарник) с учётом в qt_schema_migrations и завершается, не запуская приложение. Новые команды: make migrate-status (read-only список applied/pending), make migrate, make migrate-baseline UPTO=<file> (пометить как применённые без выполнения). migrate отказывается работать, если в истории нет ни одной применённой миграции — иначе все файлы пошли бы заново. Удалён GORM AutoMigrate против MariaDB (models.Migrate, SeedCategories): устаревший бинарник v1.18 с -migrate прогнал по боевой базе AutoMigrate своих моделей. Миграции идут через отдельное соединение без read/write таймаутов — 3s-таймаут sync-соединения обрывал backfill в 032. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2.3 KiB
2.3 KiB
05 - Config
Runtime files
| Artifact | Default location |
|---|---|
qfs.db |
OS-specific user state directory |
config.yaml |
same state directory as qfs.db |
local_encryption.key |
same state directory as qfs.db |
backups/ |
next to qfs.db unless overridden |
The runtime state directory can be overridden with QFS_STATE_DIR.
Direct paths can be overridden with QFS_DB_PATH and QFS_CONFIG_PATH.
Runtime config shape
Runtime keeps config.yaml intentionally small:
server:
host: "127.0.0.1"
port: 8080
mode: "release"
read_timeout: 30s
write_timeout: 30s
backup:
time: "00:00"
logging:
level: "info"
format: "json"
output: "stdout"
Rules:
- QuoteForge creates this file automatically if it does not exist;
- startup rewrites legacy config files into this minimal runtime shape;
- startup normalizes any
server.hostvalue to127.0.0.1before saving the runtime config; server.hostmust stay on loopback.
Saved MariaDB credentials do not live in config.yaml.
They are stored in SQLite and encrypted with local_encryption.key unless QUOTEFORGE_ENCRYPTION_KEY overrides the key material.
Environment variables
| Variable | Purpose |
|---|---|
QFS_STATE_DIR |
override runtime state directory |
QFS_DB_PATH |
explicit SQLite path |
QFS_CONFIG_PATH |
explicit config path |
QFS_BACKUP_DIR |
explicit backup root |
QFS_BACKUP_DISABLE |
disable rotating backups |
QUOTEFORGE_ENCRYPTION_KEY |
override encryption key |
QF_SERVER_PORT |
override HTTP port |
QFS_BACKUP_DISABLE accepts 1, true, or yes.
CLI flags
| Flag | Purpose |
|---|---|
-config <path> |
config file path |
-localdb <path> |
SQLite path |
-reset-localdb |
destructive local DB reset |
-migrate |
apply pending server SQL migrations (migrations/*.sql) and exit |
-migrate-status |
list server SQL migrations with applied/pending state and exit |
-migrate-baseline <file> |
record server migrations up to <file> as applied without running them, and exit |
-version |
print app version and exit |
First run
- runtime ensures
config.yamlexists; - runtime opens the local SQLite database;
- if no stored MariaDB credentials exist,
/setupis served; - after setup, runtime works locally and sync uses saved DB settings in the background.