Files
gongxue-base/.env.example
wangziqi 3bcad138a1 fix(ops): 加固部署/代理/迁移脚本,生产环境安全默认
由 OCR(open-codereview.ai,deepseek-v4-flash)审查驱动修复:
- serve-proxy:API_TARGET 生效、SPA 404 语义、流式静态文件、hop-by-hop/超时/断连/穿越防护
- migrate.sh:密码不进 argv/不泄漏 pm2、原子锁防重入、DML-only 事务说明、就绪诊断
- deploy.sh/CI:保护 .env、总是 npm ci(迁移依赖 devDeps)、健康检查、并发锁
- ecosystem/oxlint/.env.example:优雅停机、React 版本对齐、TRUST_PROXY 说明

Reviewed-by: OCR (open-codereview.ai)
2026-08-09 21:29:22 +08:00

44 lines
1.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 恭学教育 — 生产环境配置
# 复制为 .env 并修改密码
# MySQL 数据库
MYSQL_ROOT_PASSWORD=change-me-to-a-strong-password
# 后端
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USERNAME=root
DB_DATABASE=dorm_billing_v2
DB_SYNCHRONIZE=false
JWT_SECRET=change-me-to-a-random-string-at-least-32-chars
JWT_EXPIRES_IN=24h
# 初始管理员 admin 密码(仅首次创建 admin 用户时生效)
ADMIN_PASSWORD=change-me-admin-password
PORT=3002
# ---- AI 模型配置 ----
# AES-256-GCM 加密主密钥,用于加密存储 API Key
# 生产环境必须设置生成方式openssl rand -hex 32
# 格式64 位 hex推荐或 base64 编码后恰好 32 字节
# 示例 hexopenssl rand -hex 32
# 示例 base64openssl rand -base64 32
AI_CONFIG_ENCRYPTION_KEY=
# AI API Key 环境变量回退(可选)
# 若数据库未保存 Key将从该环境变量读取
# 环境变量 Key 不可从页面覆盖或清除
# AI_API_KEY=
# 允许内网地址作为 OPENAI_COMPATIBLE 的 baseUrl仅内网部署使用
# AI_ALLOW_PRIVATE_BASE_URL=true
# ---- 安全 ----
# 是否信任反向代理的 X-Forwarded-For / X-Real-IP仅当部署在可信代理/Nginx 后时才设 true
# 不设置时服务端只用 TCP socket 地址,防止伪造客户端 IP
# TRUST_PROXY=true
# 说明:第三方集成配置(钉钉/企微 appSecret的静态加密复用 AI_CONFIG_ENCRYPTION_KEY
# 存量明文可用 `cd apps/server && npm run encrypt:integration-secrets` 一次性加密。