- 创建 backend/config/ 目录统一管理配置文件 - 移动 config.yaml 到 config/config.yaml - 新增 config.dev.yaml 开发环境配置(debug 日志、关闭限流) - 新增 config.prod.yaml 生产环境配置(info 日志、启用限流、严格 CORS) - 更新配置加载逻辑,优先从 config/ 目录读取,兼容旧路径 - 更新 .gitignore,仅排除 .env,配置文件纳入版本控制
75 lines
2.3 KiB
YAML
75 lines
2.3 KiB
YAML
# CamTalk 生产环境配置
|
||
# 通过 APP_ENV=prod 加载此文件,覆盖 config.yaml 中的配置
|
||
|
||
server:
|
||
host: "0.0.0.0"
|
||
port: 8080
|
||
read_timeout: 30
|
||
write_timeout: 30
|
||
shutdown_timeout: 15 # 生产环境优雅关闭时间稍长
|
||
heartbeat_interval: 30
|
||
heartbeat_timeout: 60
|
||
allowed_origins: # 生产环境严格 CORS 白名单
|
||
- "https://camtalk.example.com"
|
||
- "https://www.camtalk.example.com"
|
||
|
||
session:
|
||
ttl: 60 # 生产环境会话 1 小时
|
||
max_history: 20
|
||
|
||
ai:
|
||
stt:
|
||
provider: mimo # 生产环境推荐 MiMo,性价比高
|
||
model: mimo-v2.5-asr
|
||
endpoint: "https://api.xiaomimimo.com/v1"
|
||
timeout: 5 # 生产环境严格超时控制
|
||
http_client_timeout: 30
|
||
llm:
|
||
provider: dashscope # 生产环境推荐通义千问,稳定性好
|
||
model: qwen3-vl-plus
|
||
endpoint: "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
||
timeout: 30
|
||
http_client_timeout: 60
|
||
tts:
|
||
provider: mimo # 生产环境推荐 MiMo TTS
|
||
model: mimo-v2.5-tts
|
||
voice: mimo_default
|
||
speed: 1.0
|
||
endpoint: "https://token-plan-cn.xiaomimimo.com/v1"
|
||
timeout: 5
|
||
http_client_timeout: 30
|
||
output_format: mp3
|
||
sample_rate: 24000
|
||
|
||
storage:
|
||
redis:
|
||
enabled: true # 生产环境必须启用 Redis
|
||
persistence:
|
||
enabled: true # 生产环境必须启用持久化
|
||
driver: postgres
|
||
|
||
redis:
|
||
addr: "redis:6379" # Docker Compose 内部服务名
|
||
password: "" # 密码通过 CAMTALK_REDIS_PASSWORD 环境变量设置
|
||
db: 0
|
||
|
||
auth:
|
||
access_ttl: 120 # 生产环境 Access Token 2 小时
|
||
refresh_ttl: 10080 # Refresh Token 7 天
|
||
|
||
ratelimit:
|
||
enabled: true # 生产环境启用限流
|
||
query:
|
||
capacity: 10 # 允许突发 10 个请求
|
||
rate: 0.2 # 每 5 秒恢复 1 个令牌
|
||
login:
|
||
capacity: 5 # 防暴力破解
|
||
rate: 0.1 # 每 10 秒恢复 1 次
|
||
register:
|
||
capacity: 3 # 防批量注册
|
||
rate: 0.05 # 每 20 秒恢复 1 次
|
||
|
||
log:
|
||
level: info # 生产环境 info 级别
|
||
format: json # JSON 格式,便于日志收集和分析
|