rebuild(stage-2): establish runtime and persistence foundations

This commit is contained in:
leefer
2026-07-30 01:02:04 +08:00
parent b3ba840d4e
commit d969d2c092
26 changed files with 865 additions and 33 deletions
+22
View File
@@ -23,6 +23,28 @@ npm.cmd run dev
浏览器访问`http://127.0.0.1:5173`。开发服务器将`/api`转发到后端8780端口。
## 运行配置
配置只从进程环境读取,不在源码或浏览器中保存密钥。基础变量:
- `APP_ENV``development``test``production`
- `APP_DATA_DIR`:持久化数据目录;相对路径以`next/`为基准。
- `APP_DATABASE_PATH`:SQLite文件路径,默认位于数据目录。
- `APP_LOG_FILE`:轮转日志路径;单文件10MB,保留3份。
- `APP_LOG_LEVEL``DEBUG``INFO``WARNING``ERROR``CRITICAL`
- `APP_HOST``APP_PORT`:监听地址和端口;迁移开发端口为8780。
- `APP_TIMEZONE`:固定为`Asia/Shanghai`,其他值会拒绝启动。
数据库维护:
```powershell
.\.venv\Scripts\python.exe -m tools.database status
.\.venv\Scripts\python.exe -m tools.database upgrade
.\.venv\Scripts\python.exe -m tools.database downgrade --target 0 --confirm-downgrade
```
回退只允许显式执行;代码回退不会自动回退数据库。
## 最小质量门禁
```powershell