feat: acid 自动嗅探逻辑

This commit is contained in:
Mmx233
2023-06-04 20:20:58 +08:00
parent 0f8ed9dd25
commit cc6d4f8da4
7 changed files with 67 additions and 18 deletions

View File

@@ -43,7 +43,7 @@ func readConfig() {
},
})
//生成配置文件
// 生成配置文件
if exist, e := tool.File.Exists(Flags.Path); e != nil {
log.Fatalln("[init] 读取配置文件失败:", e)
} else if !exist {
@@ -55,7 +55,7 @@ func readConfig() {
os.Exit(0)
}
//读取配置文件
// 读取配置文件
viper.SetConfigFile(Flags.Path)
if e := viper.ReadInConfig(); e != nil {
log.Fatalln("[init] 读取配置失败:", e)
@@ -63,4 +63,12 @@ func readConfig() {
if e := viper.Unmarshal(&Config); e != nil {
log.Fatalln("[init] 解析配置失败:", e)
}
// flag 配置覆写
if Flags.Debug {
Config.Settings.Log.DebugLevel = true
}
if Flags.Acid != "" {
Config.Meta.Acid = Flags.Acid
}
}