Merge remote-tracking branch 'origin/tuoyun' into tuoyun

# Conflicts:
#	cmd/Open-IM-SDK-Core
#	pkg/common/config/config.go
This commit is contained in:
skiffer-git
2022-01-22 09:55:54 +08:00
32 changed files with 1773 additions and 116 deletions
+16 -1
View File
@@ -3,8 +3,12 @@ package config
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"github.com/spf13/viper"
"gopkg.in/yaml.v3"
)
var (
@@ -205,7 +209,18 @@ func init() {
//bytes, err := ioutil.ReadFile(path + "/config/config.yaml")
// if we cd Open-IM-Server/src/utils and run go test
// it will panic cannot find config/config.yaml
bytes, err := ioutil.ReadFile(Root + "/config/config.yaml")
cfgName := os.Getenv("CONFIG_NAME")
if len(cfgName) == 0 {
cfgName = Root + "/config/config.yaml"
}
viper.SetConfigFile(cfgName)
err := viper.ReadInConfig()
if err != nil {
panic(err.Error())
}
bytes, err := ioutil.ReadFile(cfgName)
if err != nil {
panic(err.Error())
}