refactor: modularize backend security and observability

This commit is contained in:
237899745
2026-07-27 13:06:54 +08:00
parent f90311e68c
commit dce1e3622a
25 changed files with 1633 additions and 849 deletions

View File

@@ -89,6 +89,13 @@ COOKIE_SECURE=true
# 前端会自动从 Cookie 读取 csrf_token 并在请求头中发送
ENABLE_CSRF=true
# 全局 API IP 限流(现有登录/分享细粒度限流之外的连接兜底)
API_RATE_LIMIT_WINDOW_MS=60000
API_RATE_LIMIT_MAX=600
# 健康检查判定磁盘空间不足的阈值(默认 256MB
HEALTH_MIN_DISK_FREE_BYTES=268435456
# ============================================
# 反向代理配置Nginx/Cloudflare等
# ============================================
@@ -147,6 +154,9 @@ STORAGE_ROOT=./storage
# 日志级别 (error, warn, info, debug)
# LOG_LEVEL=info
# production 默认输出 JSON开发环境可显式开启
# LOG_FORMAT=json
# 是否启用调试模式
# DEBUG=false