0d97946123
- Updated .env.example to include optional configuration for additional database instances. - Refactored DatabaseConfig in config.go to accommodate a default database and additional instances. - Implemented loadAdditionalDBConfigs function to dynamically load configurations for extra databases. - Modified InitDB function in database.go to establish connections for both default and additional databases. - Updated README.md to document the new configuration options for connecting to multiple databases.
62 lines
1.7 KiB
Bash
Executable File
62 lines
1.7 KiB
Bash
Executable File
# 服务器配置
|
||
SERVER_PORT=8080
|
||
GIN_MODE=debug
|
||
|
||
# 数据库配置
|
||
DB_HOST=localhost
|
||
DB_PORT=3306
|
||
DB_USER=root
|
||
DB_PASSWORD=your_password
|
||
DB_NAME=wx_service
|
||
# 多数据源(可选)
|
||
# DB_INSTANCES=lawyer,reporting
|
||
# DB_LAWYER_HOST=127.0.0.1
|
||
# DB_LAWYER_PORT=3306
|
||
# DB_LAWYER_USER=another_user
|
||
# DB_LAWYER_PASSWORD=another_password
|
||
# DB_LAWYER_NAME=lawyer
|
||
|
||
# JWT配置
|
||
JWT_SECRET=your-secret-key-change-in-production
|
||
|
||
# 短视频解析配置
|
||
SHORT_VIDEO_API_KEY=replace-with-real-key
|
||
SHORT_VIDEO_FREE_QUOTA=20
|
||
SHORT_VIDEO_TIMEOUT_SECONDS=5
|
||
|
||
# AI 配置(OpenAI-compatible)
|
||
# 例:OpenAI = https://api.openai.com/v1
|
||
AI_BASE_URL=https://api.openai.com/v1
|
||
AI_API_KEY=replace-with-ai-api-key
|
||
AI_MODEL=gpt-4o-mini
|
||
AI_TIMEOUT_SECONDS=15
|
||
|
||
# 简易后台接口鉴权(用于生成兑换码等)
|
||
ADMIN_API_TOKEN=replace-with-strong-random-token
|
||
|
||
# 七牛直传配置(Kodo)
|
||
QINIU_ACCESS_KEY=replace-with-access-key
|
||
QINIU_SECRET_KEY=replace-with-secret-key
|
||
QINIU_BUCKET=replace-with-bucket
|
||
# 上传地址:可保持默认(自动调度),也可以配置具体 Region 的 up 域名
|
||
QINIU_UPLOAD_URL=https://upload.qiniup.com
|
||
# CDN 域名(可选):用于拼接最终访问地址,例如 https://cdn.example.com
|
||
QINIU_CDN_DOMAIN=
|
||
# 上传 key 前缀(可选)
|
||
QINIU_KEY_PREFIX=uploads/
|
||
# token 有效期(秒)
|
||
QINIU_TOKEN_EXPIRE_SECONDS=300
|
||
|
||
# 微信公众号(网页授权 OAuth2)
|
||
WECHAT_OA_APP_ID=replace-with-oa-appid
|
||
WECHAT_OA_APP_SECRET=replace-with-oa-appsecret
|
||
WECHAT_OA_TIMEOUT_SECONDS=5
|
||
|
||
# Redis(可选,用于缓存 session_key -> user)
|
||
# 不配置 REDIS_ADDR 时,程序会自动禁用 Redis,保持原来每次请求查 MySQL 的方式。
|
||
REDIS_ADDR=127.0.0.1:6379
|
||
REDIS_PASSWORD=
|
||
REDIS_DB=0
|
||
REDIS_KEY_PREFIX=wx_service:
|
||
REDIS_SESSION_TTL_SECONDS=86400
|