做完了一部分,备份一下,防止以外删除
This commit is contained in:
41
configs/config.dev.yaml
Normal file
41
configs/config.dev.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
server:
|
||||
address: ":3000"
|
||||
read_timeout: "10s"
|
||||
write_timeout: "10s"
|
||||
shutdown_timeout: "30s"
|
||||
prefork: false
|
||||
|
||||
redis:
|
||||
address: "cxd.whcxd.cn"
|
||||
password: "cpNbWtAaqgo1YJmbMp3h"
|
||||
port: 16299
|
||||
db: 0
|
||||
pool_size: 10
|
||||
min_idle_conns: 5
|
||||
dial_timeout: "5s"
|
||||
read_timeout: "3s"
|
||||
write_timeout: "3s"
|
||||
|
||||
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_auth: false # 开发环境可选禁用认证
|
||||
enable_rate_limiter: false
|
||||
rate_limiter:
|
||||
max: 1000
|
||||
expiration: "1m"
|
||||
storage: "memory"
|
||||
40
configs/config.prod.yaml
Normal file
40
configs/config.prod.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
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 分布式限流
|
||||
40
configs/config.staging.yaml
Normal file
40
configs/config.staging.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
server:
|
||||
address: ":8080"
|
||||
read_timeout: "10s"
|
||||
write_timeout: "10s"
|
||||
shutdown_timeout: "30s"
|
||||
prefork: false
|
||||
|
||||
redis:
|
||||
address: "redis-staging:6379"
|
||||
password: "${REDIS_PASSWORD}" # 从环境变量读取
|
||||
db: 0
|
||||
pool_size: 20
|
||||
min_idle_conns: 10
|
||||
dial_timeout: "5s"
|
||||
read_timeout: "3s"
|
||||
write_timeout: "3s"
|
||||
|
||||
logging:
|
||||
level: "info"
|
||||
development: false
|
||||
app_log:
|
||||
filename: "logs/app.log"
|
||||
max_size: 100
|
||||
max_backups: 30
|
||||
max_age: 30
|
||||
compress: true
|
||||
access_log:
|
||||
filename: "logs/access.log"
|
||||
max_size: 500
|
||||
max_backups: 90
|
||||
max_age: 90
|
||||
compress: true
|
||||
|
||||
middleware:
|
||||
enable_auth: true
|
||||
enable_rate_limiter: true
|
||||
rate_limiter:
|
||||
max: 1000
|
||||
expiration: "1m"
|
||||
storage: "memory"
|
||||
41
configs/config.yaml
Normal file
41
configs/config.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
server:
|
||||
address: ":3000"
|
||||
read_timeout: "10s"
|
||||
write_timeout: "10s"
|
||||
shutdown_timeout: "30s"
|
||||
prefork: false
|
||||
|
||||
redis:
|
||||
address: "cxd.whcxd.cn"
|
||||
password: "cpNbWtAaqgo1YJmbMp3h"
|
||||
port: 16299
|
||||
db: 0
|
||||
pool_size: 10
|
||||
min_idle_conns: 5
|
||||
dial_timeout: "5s"
|
||||
read_timeout: "3s"
|
||||
write_timeout: "3s"
|
||||
|
||||
logging:
|
||||
level: "info"
|
||||
development: false
|
||||
app_log:
|
||||
filename: "logs/app.log"
|
||||
max_size: 100 # MB
|
||||
max_backups: 30
|
||||
max_age: 30 # 天
|
||||
compress: true
|
||||
access_log:
|
||||
filename: "logs/access.log"
|
||||
max_size: 500 # MB
|
||||
max_backups: 90
|
||||
max_age: 90 # 天
|
||||
compress: true
|
||||
|
||||
middleware:
|
||||
enable_auth: true
|
||||
enable_rate_limiter: false # 默认禁用
|
||||
rate_limiter:
|
||||
max: 100 # 请求数
|
||||
expiration: "1m" # 每分钟
|
||||
storage: "memory" # 或 "redis"
|
||||
Reference in New Issue
Block a user