mirror of
https://github.com/beego/bee.git
synced 2024-11-22 10:10:53 +00:00
merge default config with config file
This commit is contained in:
parent
6dce4df2cb
commit
c782720cb7
@ -85,7 +85,12 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// loadConfig loads customized configuration.
|
// loadConfig loads customized configuration.
|
||||||
func loadConfig() (err error) {
|
func loadConfig() {
|
||||||
|
beeLogger.Log.Info("Loading default configuration...")
|
||||||
|
err := json.Unmarshal([]byte(defaultConf), &Conf)
|
||||||
|
if err != nil {
|
||||||
|
beeLogger.Log.Errorf(err.Error())
|
||||||
|
}
|
||||||
err = filepath.Walk(".", func(path string, fileInfo os.FileInfo, err error) error {
|
err = filepath.Walk(".", func(path string, fileInfo os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
@ -116,20 +121,6 @@ func loadConfig() (err error) {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
// In case no configuration file found or an error different than io.EOF,
|
|
||||||
// fallback to default configuration
|
|
||||||
if err != io.EOF {
|
|
||||||
beeLogger.Log.Info("Loading default configuration...")
|
|
||||||
err = json.Unmarshal([]byte(defaultConf), &Conf)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// No need to return io.EOF error
|
|
||||||
err = nil
|
|
||||||
|
|
||||||
// Check format version
|
// Check format version
|
||||||
if Conf.Version != confVer {
|
if Conf.Version != confVer {
|
||||||
beeLogger.Log.Warn("Your configuration file is outdated. Please do consider updating it.")
|
beeLogger.Log.Warn("Your configuration file is outdated. Please do consider updating it.")
|
||||||
|
Loading…
Reference in New Issue
Block a user