perf: 配置文件调整

This commit is contained in:
TsMask
2025-03-17 19:21:52 +08:00
parent c20a3e5f04
commit a27e1d243c
9 changed files with 21 additions and 54 deletions

View File

@@ -36,7 +36,7 @@ func AppEngine() *gin.Engine {
machine.Launch()
// 读取服务配置
app.ForwardedByClientIP = config.Get("server.proxy").(bool)
app.ForwardedByClientIP = true
return app
}

View File

@@ -1,11 +1,11 @@
# 应用服务配置
server:
# 是否开启代理
proxy: false
# 运行版本 standards/lite/tenants
runVersion: "standards"
# 运行模式 system/docker
runMode: "system"
# 运行版本 standard/lite/tenant
serverVersion: "standard"
# 运行模式 system/docker
serverMode: "system"
# 登录认证,默认打开
serverLoginAuth: true
# 接口加密,默认关闭
serverCryptoApi: false
# 日志
logger:
@@ -147,7 +147,7 @@ jwt:
database:
dataSource:
# 默认数据库实例
default:
standard:
type: "mysql"
host: "127.0.0.1"
port: 3306
@@ -161,7 +161,7 @@ database:
database: "<database path>"
logging: false
# 多个数据源时可以用这个指定默认的数据源
defaultDataSourceName: "default"
defaultDataSourceName: "standard"
# Redis 缓存数据
redis:
@@ -183,21 +183,9 @@ aes:
# 应用密钥
appKey: "E83dbfeb35BA4839232e2761b0FE5f32"
# 用户配置
user:
# 登录认证,默认打开
loginAuth: true
# 接口加密,默认打开
cryptoApi: false
# 密码
password:
# 密码最大错误次数
maxRetryCount: 5
# 密码锁定时间,单位分钟默认10分钟
lockTime: 10
# 设定为系统管理员的用户ID
system:
- 1
# 设定为系统管理员的用户ID
systemUser:
- 1
# char 字符验证码配置
charCaptcha:

View File

@@ -1,7 +1,3 @@
# 应用服务配置
server:
proxy: true
# 日志
logger:
fileDir: "C:/var/log"

View File

@@ -1,12 +1,3 @@
# 应用服务配置
server:
# 是否开启代理
proxy: true
# 运行版本 standards/lite/tenants
runVersion: "standards"
# 运行模式 system/docker
runMode: "system"
# DB 数据源
database:
dataSource:

View File

@@ -166,7 +166,7 @@ func RunTime() time.Time {
// Get 获取配置信息
//
// Get("server.proxy")
// Get("redis.defaultDataSourceName")
func Get(key string) any {
return conf.Get(key)
}
@@ -187,7 +187,7 @@ func IsSystemUser(userId int64) bool {
return false
}
// 从配置中获取系统管理员ID列表
arr := Get("user.system").([]any)
arr := Get("systemUser").([]any)
for _, v := range arr {
if fmt.Sprint(v) == fmt.Sprint(userId) {
return true

View File

@@ -26,10 +26,7 @@ import (
func CryptoApi(requestDecrypt, responseEncrypt bool) gin.HandlerFunc {
return func(c *gin.Context) {
// 登录认证,默认打开
enable := true
if v := config.Get("user.cryptoApi"); v != nil && enable {
enable = v.(bool)
}
enable := parse.Boolean(config.Get("serverCryptoApi"))
if !enable {
c.Next()
return

View File

@@ -9,6 +9,7 @@ import (
"be.ems/src/framework/reqctx"
"be.ems/src/framework/resp"
"be.ems/src/framework/token"
"be.ems/src/framework/utils/parse"
"github.com/gin-gonic/gin"
)
@@ -38,10 +39,7 @@ var URL_WHITE_LIST = []string{
func PreAuthorize(options map[string][]string) gin.HandlerFunc {
return func(c *gin.Context) {
// 登录认证,默认打开
enable := true
if v := config.Get("user.loginAuth"); v != nil {
enable = v.(bool)
}
enable := parse.Boolean(config.Get("serverLoginAuth"))
if !enable {
loginUser, _ := reqctx.LoginUser(c)
loginUser.UserId = 2

View File

@@ -127,9 +127,6 @@ func (s Account) passwordRetryCount(userName string) (string, int64, time.Durati
// 验证登录次数和错误锁定时间
maxRetryCount := parse.Number(maxRetryCountStr)
lockTime := parse.Number(lockTimeStr)
// 验证登录次数和错误锁定时间
// maxRetryCount := config.Get("user.password.maxRetryCount").(int)
// lockTime := config.Get("user.password.lockTime").(int)
// 验证缓存记录次数
retryKey := fmt.Sprintf("%s:%s", constants.CACHE_PWD_ERR_COUNT, userName)

View File

@@ -39,9 +39,9 @@ func (s *Commont) SystemConfigInfo() map[string]string {
infoMap[constants.LAUNCH_BOOTLOADER] = "true"
}
// 用户登录认证
infoMap["loginAuth"] = fmt.Sprint(config.Get("user.loginAuth"))
infoMap["loginAuth"] = fmt.Sprint(config.Get("serverLoginAuth"))
// 用户接口加密
infoMap["cryptoApi"] = fmt.Sprint(config.Get("user.cryptoApi"))
infoMap["cryptoApi"] = fmt.Sprint(config.Get("serverCryptoApi"))
// 序列号
infoMap["serialNum"] = fmt.Sprint(config.Get("omc.sn"))
// 获取LOGO类型