添加系统运行配置文件写入redis,用于排查

This commit is contained in:
junleea 2025-05-03 11:48:02 +08:00
parent f93288cf0e
commit 6d13cb36fb
1 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package proto package proto
import ( import (
"StuAcaWorksAI/worker"
"encoding/json" "encoding/json"
"fmt" "fmt"
"gorm.io/gorm" "gorm.io/gorm"
@ -136,6 +137,13 @@ func ReadConfig(path string) error {
} }
} }
SigningKey = []byte(Config.TOKEN_SECRET) SigningKey = []byte(Config.TOKEN_SECRET)
//将当前配置文件的信息写入redis,用于程序运行时排查
configJson, cErr := json.Marshal(Config)
if cErr != nil {
fmt.Println("ReadConfig Error encoding config,err :", cErr)
} else {
worker.SetRedis("system_config_info", string(configJson))
}
return err return err
} }