Files
CamTalk/backend/.env.example
hhs 515d7ae034 docs: 完善配置环境切换机制
- docker-compose.yml 添加 APP_ENV=prod 强制生产环境
- 更新 .env.example 的 APP_ENV 注释说明(开发/生产差异)
- CLAUDE.md 补充"配置环境切换"章节,说明本地开发和生产部署的配置切换方式
- 明确配置优先级:环境变量 > config.{env}.yaml > config.yaml > 默认值

配置差异:
- 开发环境:debug 日志、关闭限流、允许所有 CORS
- 生产环境:info/json 日志、启用限流、严格 CORS 白名单

验证通过:
- 本地开发:默认加载 config.dev.yaml(env=dev, debug 日志)
- 生产配置:APP_ENV=prod 加载 config.prod.yaml(env=prod, info 日志)
2026-06-21 01:14:29 +08:00

33 lines
1.2 KiB
Plaintext
Raw Permalink 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.
# 运行环境
# dev本地开发环境debug 日志、关闭限流、允许所有 CORS
# prod生产环境info 日志、启用限流、严格 CORS 白名单)
# 本地开发保持 dev生产部署会被 docker-compose.yml 覆盖为 prod
APP_ENV=dev
# AI 服务 API Key
CAMTALK_AI_STT_API_KEY=sk-your-stt-key
CAMTALK_AI_LLM_API_KEY=sk-your-llm-key
CAMTALK_AI_TTS_API_KEY=sk-your-tts-key
# JWT 认证
CAMTALK_AUTH_JWT_SECRET=your-jwt-secret-here
# 三级存储配置
# L2: Redis热数据分布式会话层
CAMTALK_STORAGE_REDIS_ENABLED=true
# 开发时填写远程服务器地址,部署时 docker-compose 会覆盖为容器内网地址
CAMTALK_REDIS_ADDR=your-remote-server:6379
CAMTALK_REDIS_PASSWORD=your-redis-password
# L3: PostgreSQL冷数据持久化层
CAMTALK_STORAGE_PERSISTENCE_ENABLED=true
CAMTALK_STORAGE_PERSISTENCE_DRIVER=postgres
POSTGRES_USER=camtalk
POSTGRES_PASSWORD=your-postgres-password
# 开发时填写远程服务器地址,部署时 docker-compose 会覆盖为容器内网地址
CAMTALK_STORAGE_DSN=postgres://camtalk:your-postgres-password@your-remote-server:5432/camtalk?sslmode=disable
# 可选覆盖(默认值见 config.yaml
# CAMTALK_SERVER_PORT=8080
# CAMTALK_LOG_LEVEL=info