refactor: 统一配置文件系统

- 补全 backend/config.yaml 所有非敏感配置项并添加中文注释
- 重写 config.go:Load(workDir) 显式传参,BindEnv 绑定敏感字段,删除 AutomaticEnv
- setDefaults 默认值与 config.yaml 保持一致(mimo/dashscope)
- backend/.env.example 重写为纯敏感信息模板
- .env 固定在 /opt/camtalk/.env,docker-compose 通过绝对路径加载
- deploy.sh 统一使用 --env-file,移除硬编码 IP
- deploy.yml 删除 CI 写入 .env 的步骤
- Dockerfile 移除 COPY config.yaml
- 修复 deploy.yml 中 POSTGRES_PASSWORD 的 &{{ 拼写错误
This commit is contained in:
hhs
2026-06-19 18:41:35 +08:00
parent e6481e0faa
commit c0b4eeda46
12 changed files with 226 additions and 145 deletions

23
backend/.env.example Normal file
View File

@@ -0,0 +1,23 @@
# 运行环境
# dev / prod决定加载 config.dev.yaml 或 config.prod.yaml可选
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
# PostgreSQLstorage.driver 为 postgres 时必填)
POSTGRES_USER=camtalk
POSTGRES_PASSWORD=your-postgres-password
CAMTALK_STORAGE_DSN=postgres://camtalk:your-postgres-password@postgres:5432/camtalk?sslmode=disable
# 可选覆盖(默认值见 config.yaml
# CAMTALK_SERVER_PORT=8080
# CAMTALK_LOG_LEVEL=info
# CAMTALK_STORAGE_DRIVER=memory
# CAMTALK_REDIS_ADDR=localhost:6379
# CAMTALK_REDIS_PASSWORD=