78 lines
2.8 KiB
YAML
78 lines
2.8 KiB
YAML
Server:
|
|
Domain: test.com #服务域名,用于 CORS 允许来源(http/https 均放行);置 * 或不填则允许所有来源
|
|
RunMode: release #gin运行模式,debug 和 release
|
|
HttpPort: 8082
|
|
ReadTimeout: 60
|
|
WriteTimeout: 60
|
|
Log:
|
|
LogSavePath: storage/logs
|
|
LogFileName: app
|
|
LogFileExt: .log
|
|
MaxSize: 100
|
|
MaxBackups: 10
|
|
MaxAge: 30
|
|
LogLevel: Info #日志级别,Debug, Info, Warn, Error
|
|
Mysql:
|
|
UserName: your_mysql_user
|
|
Password: your_mysql_password
|
|
Host: 127.0.0.1
|
|
Port: 3306
|
|
DBName: your_db_name
|
|
MaxIdleConns: 30
|
|
MaxOpenConns: 100
|
|
ConnMaxLifeTime: 3600
|
|
ConnMaxIdleTime: 600
|
|
Redis:
|
|
Host: 127.0.0.1
|
|
Port: 6379
|
|
Password: ""
|
|
DB: 0
|
|
PoolSize: 20
|
|
MinIdleConns: 5
|
|
MaxIdleConns: 10
|
|
MaxRetryBackoff: 10
|
|
MinRetryBackoff: 500
|
|
MaxRetries: 3
|
|
DialTimeout: 5
|
|
ReadTimeout: 3
|
|
WriteTimeout: 3
|
|
PoolTimeout: 4
|
|
JWT:
|
|
SecretKey: replace_with_a_strong_random_secret # 必填,为空则启动失败
|
|
Issuer: zt-online-game-backend
|
|
AccessTokenExpire: 7200
|
|
RefreshTokenExpire: 86400
|
|
Upload:
|
|
TmpSavePath: storage/tmp
|
|
MaxSizeMB: 20
|
|
AllowedExtensions:
|
|
- jpg
|
|
- jpeg
|
|
- png
|
|
Cos:
|
|
CosSecretID: your_cos_secret_id # 腾讯云 COS SecretId
|
|
CosSecretKey: your_cos_secret_key # 腾讯云 COS SecretKey
|
|
CosUploadDomain: your_cos_upload_domain # 上传域名
|
|
CosDownloadDomain: your_cos_download_domain # 下载域名
|
|
CdnDownloadSecretKey: your_cdn_download_secret_key # CDN 下载鉴权密钥
|
|
WechatMini:
|
|
AppID: your_mini_appid
|
|
AppSecret: your_mini_appsecret
|
|
WS:
|
|
PingInterval: 25 # 客户端心跳间隔(秒);服务端读超时取其 2 倍
|
|
ReadTimeout: 50 # 读超时(秒):超过该时长未收到任何消息即判死断开
|
|
WriteTimeout: 10 # 单条消息写超时(秒)
|
|
MaxMessageBytes: 8192 # 单帧上限(字节)
|
|
MaxMsgPerSec: 20 # 单连接每秒消息数上限,超出断开
|
|
SendQueueSize: 64 # 每连接发送队列长度,写满视为慢客户端并断开
|
|
Compression: false # 是否启用 permessage-deflate 压缩
|
|
MultiDevice: false # false=同账号新连接踢掉旧连接
|
|
OriginPatterns: [] # 允许的 Origin 域名(浏览器调试用,小游戏连接不带 Origin)
|
|
ReconnectGraceSec: 30 # 掉线后保留座位的时长(秒),超时未重连则判负或平局
|
|
RoomIdleTimeoutSec: 300 # 房间空闲自动关闭的时长(秒)
|
|
MatchTimeoutSec: 60 # 匹配排队超过该时长(秒)自动取消
|
|
QueueTickMs: 1000 # 匹配队列的扫描间隔(毫秒)
|
|
MaxRooms: 1000 # 同时存在的房间数上限,防止内存失控
|
|
AIEnabled: true # 匹配超时后用 AI 补齐空位(对外不可感知)
|
|
AIWaitSec: 30 # 排队超过该秒数仍未凑满则补 AI;0 表示不启用
|