41 lines
851 B
YAML
41 lines
851 B
YAML
server:
|
|
address: ":8080"
|
|
read_timeout: "10s"
|
|
write_timeout: "10s"
|
|
shutdown_timeout: "30s"
|
|
prefork: true # 生产环境启用多进程模式
|
|
|
|
redis:
|
|
address: "redis-prod:6379"
|
|
password: "${REDIS_PASSWORD}"
|
|
db: 0
|
|
pool_size: 50 # 生产环境更大的连接池
|
|
min_idle_conns: 20
|
|
dial_timeout: "5s"
|
|
read_timeout: "3s"
|
|
write_timeout: "3s"
|
|
|
|
logging:
|
|
level: "warn" # 生产环境较少详细日志
|
|
development: false
|
|
app_log:
|
|
filename: "logs/app.log"
|
|
max_size: 100
|
|
max_backups: 60
|
|
max_age: 60
|
|
compress: true
|
|
access_log:
|
|
filename: "logs/access.log"
|
|
max_size: 500
|
|
max_backups: 180
|
|
max_age: 180
|
|
compress: true
|
|
|
|
middleware:
|
|
enable_auth: true
|
|
enable_rate_limiter: true
|
|
rate_limiter:
|
|
max: 5000
|
|
expiration: "1m"
|
|
storage: "redis" # 生产环境使用 Redis 分布式限流
|