mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-29 17:59:23 +08:00
test cobra
This commit is contained in:
parent
373b317b1a
commit
6ad93962aa
@ -2,6 +2,7 @@ package config
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/discoveryregistry"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -500,10 +501,14 @@ func (c *config) initConfig(config interface{}, configName, configFolderPath str
|
||||
if configFolderPath == "" {
|
||||
configFolderPath = DefaultFolderPath
|
||||
}
|
||||
_, err := os.Stat(filepath.Join(configFolderPath, configName))
|
||||
var configPath string
|
||||
if os.IsNotExist(err) {
|
||||
configPath := filepath.Join(configFolderPath, configName)
|
||||
_, err := os.Stat(configPath)
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
configPath = filepath.Join(Root, "config", configName)
|
||||
fmt.Println(configPath, "not exist, use", configPath)
|
||||
}
|
||||
Root = filepath.Dir(configPath)
|
||||
return c.unmarshalConfig(config, configPath)
|
||||
|
Loading…
x
Reference in New Issue
Block a user