perf: 配置文件调整
This commit is contained in:
@@ -36,7 +36,7 @@ func AppEngine() *gin.Engine {
|
|||||||
machine.Launch()
|
machine.Launch()
|
||||||
|
|
||||||
// 读取服务配置
|
// 读取服务配置
|
||||||
app.ForwardedByClientIP = config.Get("server.proxy").(bool)
|
app.ForwardedByClientIP = true
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
# 应用服务配置
|
# 运行版本 standard/lite/tenant
|
||||||
server:
|
serverVersion: "standard"
|
||||||
# 是否开启代理
|
|
||||||
proxy: false
|
|
||||||
# 运行版本 standards/lite/tenants
|
|
||||||
runVersion: "standards"
|
|
||||||
# 运行模式 system/docker
|
# 运行模式 system/docker
|
||||||
runMode: "system"
|
serverMode: "system"
|
||||||
|
# 登录认证,默认打开
|
||||||
|
serverLoginAuth: true
|
||||||
|
# 接口加密,默认关闭
|
||||||
|
serverCryptoApi: false
|
||||||
|
|
||||||
# 日志
|
# 日志
|
||||||
logger:
|
logger:
|
||||||
@@ -147,7 +147,7 @@ jwt:
|
|||||||
database:
|
database:
|
||||||
dataSource:
|
dataSource:
|
||||||
# 默认数据库实例
|
# 默认数据库实例
|
||||||
default:
|
standard:
|
||||||
type: "mysql"
|
type: "mysql"
|
||||||
host: "127.0.0.1"
|
host: "127.0.0.1"
|
||||||
port: 3306
|
port: 3306
|
||||||
@@ -161,7 +161,7 @@ database:
|
|||||||
database: "<database path>"
|
database: "<database path>"
|
||||||
logging: false
|
logging: false
|
||||||
# 多个数据源时可以用这个指定默认的数据源
|
# 多个数据源时可以用这个指定默认的数据源
|
||||||
defaultDataSourceName: "default"
|
defaultDataSourceName: "standard"
|
||||||
|
|
||||||
# Redis 缓存数据
|
# Redis 缓存数据
|
||||||
redis:
|
redis:
|
||||||
@@ -183,20 +183,8 @@ aes:
|
|||||||
# 应用密钥
|
# 应用密钥
|
||||||
appKey: "E83dbfeb35BA4839232e2761b0FE5f32"
|
appKey: "E83dbfeb35BA4839232e2761b0FE5f32"
|
||||||
|
|
||||||
# 用户配置
|
|
||||||
user:
|
|
||||||
# 登录认证,默认打开
|
|
||||||
loginAuth: true
|
|
||||||
# 接口加密,默认打开
|
|
||||||
cryptoApi: false
|
|
||||||
# 密码
|
|
||||||
password:
|
|
||||||
# 密码最大错误次数
|
|
||||||
maxRetryCount: 5
|
|
||||||
# 密码锁定时间,单位分钟(默认10分钟)
|
|
||||||
lockTime: 10
|
|
||||||
# 设定为系统管理员的用户ID
|
# 设定为系统管理员的用户ID
|
||||||
system:
|
systemUser:
|
||||||
- 1
|
- 1
|
||||||
|
|
||||||
# char 字符验证码配置
|
# char 字符验证码配置
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
# 应用服务配置
|
|
||||||
server:
|
|
||||||
proxy: true
|
|
||||||
|
|
||||||
# 日志
|
# 日志
|
||||||
logger:
|
logger:
|
||||||
fileDir: "C:/var/log"
|
fileDir: "C:/var/log"
|
||||||
|
|||||||
@@ -1,12 +1,3 @@
|
|||||||
# 应用服务配置
|
|
||||||
server:
|
|
||||||
# 是否开启代理
|
|
||||||
proxy: true
|
|
||||||
# 运行版本 standards/lite/tenants
|
|
||||||
runVersion: "standards"
|
|
||||||
# 运行模式 system/docker
|
|
||||||
runMode: "system"
|
|
||||||
|
|
||||||
# DB 数据源
|
# DB 数据源
|
||||||
database:
|
database:
|
||||||
dataSource:
|
dataSource:
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ func RunTime() time.Time {
|
|||||||
|
|
||||||
// Get 获取配置信息
|
// Get 获取配置信息
|
||||||
//
|
//
|
||||||
// Get("server.proxy")
|
// Get("redis.defaultDataSourceName")
|
||||||
func Get(key string) any {
|
func Get(key string) any {
|
||||||
return conf.Get(key)
|
return conf.Get(key)
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ func IsSystemUser(userId int64) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// 从配置中获取系统管理员ID列表
|
// 从配置中获取系统管理员ID列表
|
||||||
arr := Get("user.system").([]any)
|
arr := Get("systemUser").([]any)
|
||||||
for _, v := range arr {
|
for _, v := range arr {
|
||||||
if fmt.Sprint(v) == fmt.Sprint(userId) {
|
if fmt.Sprint(v) == fmt.Sprint(userId) {
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -26,10 +26,7 @@ import (
|
|||||||
func CryptoApi(requestDecrypt, responseEncrypt bool) gin.HandlerFunc {
|
func CryptoApi(requestDecrypt, responseEncrypt bool) gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
// 登录认证,默认打开
|
// 登录认证,默认打开
|
||||||
enable := true
|
enable := parse.Boolean(config.Get("serverCryptoApi"))
|
||||||
if v := config.Get("user.cryptoApi"); v != nil && enable {
|
|
||||||
enable = v.(bool)
|
|
||||||
}
|
|
||||||
if !enable {
|
if !enable {
|
||||||
c.Next()
|
c.Next()
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"be.ems/src/framework/reqctx"
|
"be.ems/src/framework/reqctx"
|
||||||
"be.ems/src/framework/resp"
|
"be.ems/src/framework/resp"
|
||||||
"be.ems/src/framework/token"
|
"be.ems/src/framework/token"
|
||||||
|
"be.ems/src/framework/utils/parse"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
@@ -38,10 +39,7 @@ var URL_WHITE_LIST = []string{
|
|||||||
func PreAuthorize(options map[string][]string) gin.HandlerFunc {
|
func PreAuthorize(options map[string][]string) gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
// 登录认证,默认打开
|
// 登录认证,默认打开
|
||||||
enable := true
|
enable := parse.Boolean(config.Get("serverLoginAuth"))
|
||||||
if v := config.Get("user.loginAuth"); v != nil {
|
|
||||||
enable = v.(bool)
|
|
||||||
}
|
|
||||||
if !enable {
|
if !enable {
|
||||||
loginUser, _ := reqctx.LoginUser(c)
|
loginUser, _ := reqctx.LoginUser(c)
|
||||||
loginUser.UserId = 2
|
loginUser.UserId = 2
|
||||||
|
|||||||
@@ -127,9 +127,6 @@ func (s Account) passwordRetryCount(userName string) (string, int64, time.Durati
|
|||||||
// 验证登录次数和错误锁定时间
|
// 验证登录次数和错误锁定时间
|
||||||
maxRetryCount := parse.Number(maxRetryCountStr)
|
maxRetryCount := parse.Number(maxRetryCountStr)
|
||||||
lockTime := parse.Number(lockTimeStr)
|
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)
|
retryKey := fmt.Sprintf("%s:%s", constants.CACHE_PWD_ERR_COUNT, userName)
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ func (s *Commont) SystemConfigInfo() map[string]string {
|
|||||||
infoMap[constants.LAUNCH_BOOTLOADER] = "true"
|
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"))
|
infoMap["serialNum"] = fmt.Sprint(config.Get("omc.sn"))
|
||||||
// 获取LOGO类型
|
// 获取LOGO类型
|
||||||
|
|||||||
Reference in New Issue
Block a user