Files
junhong_cmp_fiber/configs/config.yaml
huang 6821e5abcf
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m36s
refactor: 统一错误消息数据源,优化错误码与映射表管理
主要改动:
- 改造 errors.New() 和 Wrap() 函数签名为可变参数,优先使用 errorMessages 映射表
- 添加 allErrorCodes 注册表和 init() 启动时校验,确保错误码与映射表一致
- 添加 TestAllCodesHaveMessages 和 TestNoOrphanMessages 测试防止映射表腐化
- 清理 109 处与映射表一致的冗余硬编码(service 层)
- 保留业务特定消息覆盖能力

新增 API 用法:
- errors.New(errors.CodeUnauthorized) // 使用映射表默认消息
- errors.New(errors.CodeNotFound, "提现申请不存在") // 覆盖为自定义消息
2026-01-22 18:27:42 +08:00

85 lines
2.0 KiB
YAML
Raw 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.
server:
address: ":3000"
read_timeout: "10s"
write_timeout: "10s"
shutdown_timeout: "30s"
prefork: false
redis:
address: "cxd.whcxd.cn"
password: "cpNbWtAaqgo1YJmbMp3h"
port: 16299
db: 6
pool_size: 10
min_idle_conns: 5
dial_timeout: "5s"
read_timeout: "3s"
write_timeout: "3s"
database:
host: "cxd.whcxd.cn"
port: 16159
user: "erp_pgsql"
password: "erp_2025"
dbname: "junhong_cmp_test"
sslmode: "disable"
max_open_conns: 25
max_idle_conns: 10
conn_max_lifetime: "5m"
queue:
concurrency: 10
queues:
critical: 6
default: 3
low: 1
retry_max: 5
timeout: "10m"
logging:
level: "debug" # 开发环境使用 debug 级别
development: true # 启用开发模式(美化日志输出)
app_log:
filename: "logs/app.log"
max_size: 100
max_backups: 10 # 开发环境保留较少备份
max_age: 7 # 7天
compress: false # 开发环境不压缩
access_log:
filename: "logs/access.log"
max_size: 100
max_backups: 10
max_age: 7
compress: false
middleware:
enable_rate_limiter: true
rate_limiter:
max: 1000
expiration: "1m"
storage: "redis"
sms:
gateway_url: "https://gateway.sms.whjhft.com:8443/sms"
username: "JH0001" # TODO: 替换为实际的短信服务账号
password: "wwR8E4qnL6F0" # TODO: 替换为实际的短信服务密码
signature: "【JHFTIOT】" # TODO: 替换为报备通过的短信签名
timeout: "10s"
# JWT 配置
jwt:
secret_key: "dev-secret-key-for-testing-only-32chars!"
token_duration: "168h" # C 端个人客户 JWT Token 有效期7天
access_token_ttl: "24h" # B 端访问令牌有效期24小时
refresh_token_ttl: "168h" # B 端刷新令牌有效期7天
# 默认超级管理员配置(可选,系统启动时自动创建)
# 如果配置为空,系统使用代码默认值:
# - 用户名: admin
# - 密码: Admin@123456
# - 手机号: 13800000000
# default_admin:
# username: "admin"
# password: "Admin@123456"
# phone: "13800000000"