Merge branch 'v2.3.0release' of github.com:OpenIMSDK/Open-IM-Server into v2.3.0release

This commit is contained in:
wangchuxiao
2022-08-01 17:45:09 +08:00
3 changed files with 23 additions and 10 deletions
+21 -9
View File
@@ -512,16 +512,28 @@ type PDefaultTips struct {
func init() {
cfgName := os.Getenv("CONFIG_NAME")
fmt.Println("GET IM DEFAULT CONFIG PATH :", Root, "ENV PATH:", cfgName, b, filepath.Dir(b))
fmt.Println("GET IM DEFAULT CONFIG PATH :", Root, "ENV PATH:", cfgName)
if len(cfgName) != 0 {
Root = cfgName
bytes, err := ioutil.ReadFile(filepath.Join(cfgName, "config", "config.yaml"))
if err != nil {
bytes, err = ioutil.ReadFile(filepath.Join(Root, "config", "config.yaml"))
if err != nil {
panic(err.Error())
}
} else {
Root = cfgName
}
if err = yaml.Unmarshal(bytes, &Config); err != nil {
panic(err.Error())
}
} else {
bytes, err := ioutil.ReadFile(filepath.Join(Root, "config", "config.yaml"))
if err != nil {
panic(err.Error())
}
if err = yaml.Unmarshal(bytes, &Config); err != nil {
panic(err.Error())
}
}
bytes, err := ioutil.ReadFile(filepath.Join(Root, "config", "config.yaml"))
if err != nil {
panic(err.Error())
}
if err = yaml.Unmarshal(bytes, &Config); err != nil {
panic(err.Error())
}
}