mirror of
https://github.com/beego/bee.git
synced 2024-12-22 10:00:50 +00:00
Merge pull request #369 from sergeylanzman/merge-default-config-with-config-file
merge default config with config file
This commit is contained in:
commit
78836f0a4c
@ -88,7 +88,12 @@ func init() {
|
||||
}
|
||||
|
||||
// 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 {
|
||||
if err != nil {
|
||||
return nil
|
||||
@ -119,20 +124,6 @@ func loadConfig() (err error) {
|
||||
}
|
||||
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
|
||||
if Conf.Version != confVer {
|
||||
beeLogger.Log.Warn("Your configuration file is outdated. Please do consider updating it.")
|
||||
|
Loading…
Reference in New Issue
Block a user