refactor: 重组配置文件到 config 目录

- 创建 backend/config/ 目录统一管理配置文件
- 移动 config.yaml 到 config/config.yaml
- 新增 config.dev.yaml 开发环境配置(debug 日志、关闭限流)
- 新增 config.prod.yaml 生产环境配置(info 日志、启用限流、严格 CORS)
- 更新配置加载逻辑,优先从 config/ 目录读取,兼容旧路径
- 更新 .gitignore,仅排除 .env,配置文件纳入版本控制
This commit is contained in:
hhs
2026-06-21 01:07:47 +08:00
parent 7adf81c6e5
commit 311330cea1
5 changed files with 132 additions and 4 deletions

View File

@@ -0,0 +1,55 @@
# CamTalk 开发环境配置
# 通过 APP_ENV=dev 加载此文件,覆盖 config.yaml 中的配置
server:
host: "0.0.0.0"
port: 8080
heartbeat_interval: 30
heartbeat_timeout: 60
allowed_origins: [] # 开发环境允许所有来源
session:
ttl: 30 # 开发环境会话较短,方便测试过期逻辑
max_history: 20
ai:
stt:
timeout: 10 # 开发环境超时较长,方便调试
http_client_timeout: 30
llm:
timeout: 60 # 开发环境 LLM 超时较长
http_client_timeout: 120
tts:
timeout: 10
http_client_timeout: 30
storage:
redis:
enabled: true # 开发环境启用 Redis测试三级存储
persistence:
enabled: true # 开发环境启用持久化
redis:
addr: "localhost:6379" # 本地 Redis
password: ""
db: 0
auth:
access_ttl: 120 # 开发环境 Access Token 2 小时,方便调试
refresh_ttl: 10080 # 7 天
ratelimit:
enabled: false # 开发环境关闭限流,方便测试
query:
capacity: 10
rate: 0.2
login:
capacity: 5
rate: 0.1
register:
capacity: 3
rate: 0.05
log:
level: debug # 开发环境 debug 日志
format: console # 控制台格式,易读