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