mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
config file update
This commit is contained in:
parent
4003befc2a
commit
22a39ed4d3
@ -512,15 +512,28 @@ type PDefaultTips struct {
|
||||
|
||||
func init() {
|
||||
cfgName := os.Getenv("CONFIG_NAME")
|
||||
if len(cfgName) != 0 {
|
||||
Root = cfgName
|
||||
}
|
||||
fmt.Println("GET IM DEFAULT CONFIG PATH :", Root, "ENV PATH:", cfgName)
|
||||
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())
|
||||
if len(cfgName) != 0 {
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user