🔧 update config file

This commit is contained in:
2024-12-18 16:10:48 +08:00
parent 24df28e53f
commit 49831fc4d0
5 changed files with 100 additions and 35 deletions

View File

@@ -1,33 +1,104 @@
Name: main
# 定义服务的名称,会出现在 log 和 tracer 中
Name: schisandra-cloud-album
# 监听地址
Host: 0.0.0.0
# 监听端口
Port: 80
# 服务的环境,目前我们预定义了 dev。在dev 环境我们会开启反射 dev,test,rt,pre, pro
Mode: pro
# 打点上报,将一些 metrics 上报到对应的地址,如果为空,则不上报
MetricsUrl:
# 并发请求数
MaxConns: 100
# 超时时间(ms)
Timeout: 5000
# 降载阈值默认900(90%)可允许设置范围0到1000
CpuThreshold: 900
# 最大ContentLength
MaxBytes: 10485760
# 是否打印详细日志
Verbose: false
# 日志配置
Log:
# 服务名称
ServiceName: schisandra-cloud-album
# 日志打印模式console 控制台 file, console
Mode: console
# 日志格式, json 格式 或者 plain 纯文本
Encoding: plain
# 日期格式化
TimeFormat:
# 日志在文件输出模式下,日志输出路径
Path: logs
# 日志输出级别 debug,info,error,severe
Level: debug
# 日志长度限制,打印单个日志的时候会对日志进行裁剪,只有对 content 进行裁剪
MaxContentLength: 0
# 是否压缩日志
Compress: true
# 是否开启 stat 日志go-zero 版本大于等于1.5.0才支持
Stat: true
# 日志保留天数,只有在文件模式才会生效
KeepDays: 7
# 堆栈打印冷却时间
StackCooldownMillis: 100
# 文件输出模式,按照大小分割时,最多文件保留个数
MaxBackups: 5
# 文件输出模式,按照大小分割时,单个文件大小
MaxSize: 0
# 文件分割模式, daily 按日期 daily,size
Rotation: daily
# 文件名日期格式
FileTimeFormat:
Web:
URL: http://localhost:5173
URL: https://www.landaiqing.cn
# 启用中间件
Middlewares:
# 访问日志中间件
Log: true
# MySQL 配置
Mysql:
# 数据源dsn
DataSource: root:LDQ20020618xxx@tcp(1.95.0.111:3306)/schisandra-cloud-album?charset=utf8mb4&parseTime=True&loc=Local
# 最大连接数
MaxOpenConn: 10
# 最大空闲连接数
MaxIdleConn: 5
# Auth 配置
Auth:
# 访问密钥
AccessSecret: uOvKLmVfztaXGpNYd4Z0I1SiT7MweJhl
# 签名配置
Signature:
# 签名模式
Strict: true
# 签名过期时间
Expiry: 1h
# 签名私钥文件
PrivateKeys:
- Fingerprint: idm0jdoau38lwourb4pbjk4dxkat0kcx
KeyFile: etc/rsa_private_key.pem
# Redis 配置
Redis:
# Redis 地址
Host: 1.95.0.111:6379
# Redis 密码
Pass: LDQ20020618xxx
# Redis 数据库
DB: 0
# Mongo 配置
Mongo:
# MongoDB 地址
Uri: mongodb://1.95.0.111:27017
# MongoDB 用户名
Username: landaiqing
# MongoDB 密码
Password: LDQ20020618xxx
# MongoDB 数据库
Database: schisandra-cloud-album
# MongoDB 认证源
AuthSource: admin
# 微信配置
Wechat:
# 微信公众号APPID
AppID: wx55251c2f83b9fc25
@@ -37,6 +108,7 @@ Wechat:
Token: LDQ20020618xxx
# 微信公众号EncodingAESKey
AESKey:
# OAuth 配置
OAuth:
# Github配置
Github:
@@ -64,6 +136,7 @@ OAuth:
RedirectURI: https://landaiqing.cn/api/oauth/qq/callback
# 短信配置
SMS:
# 短信服务商配置
Ali:
# 阿里云API地址
Host: http://dysmsapi.aliyuncs.com
@@ -75,6 +148,7 @@ SMS:
TemplateCode: SMS_154950909
# 短信签名
Signature: 阿里云短信测试
# 短信宝配置
SMSBao:
# 短信宝用户账号
Username: landaiqing

View File

@@ -23,11 +23,11 @@ func NewMySQL(url string, maxOpenConn int, maxIdleConn int, client *redis.Client
Logger: logger.New(
log.New(os.Stdout, "\r\n", log.LstdFlags),
logger.Config{
SlowThreshold: time.Second, // 慢sql日志
LogLevel: logger.Info, // 级别
Colorful: true, // 颜色
IgnoreRecordNotFoundError: true, // 忽略RecordNotFoundError
ParameterizedQueries: true, // 格式化SQL语句
SlowThreshold: time.Second, // 慢sql日志
LogLevel: logger.Error, // 级别
Colorful: true, // 颜色
IgnoreRecordNotFoundError: true, // 忽略RecordNotFoundError
ParameterizedQueries: true, // 格式化SQL语句
}),
})
if err != nil {
@@ -51,7 +51,7 @@ func NewMySQL(url string, maxOpenConn int, maxIdleConn int, client *redis.Client
CacheTTL: 10000, // 5000 ms
CacheMaxItemCnt: 0, // if length of objects retrieved one single time
AsyncWrite: true, // async write to cache
DebugMode: true,
DebugMode: false,
DisableCachePenetrationProtect: true, // disable cache penetration protect
})
if err != nil {