1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-29 13:01:30 +00:00

Log config parsing errors

Beego currently handles the case of "conf/app.conf"
not existing, but all other errors are not logged.
This fixes that.

I ran into an issue where beego was not listening on the
correct port, and it turned out that the conf/app.conf file
had a colon ":" instead of an equal sign "=" (confusion of
INI vs YAML formats).  When there was a parsing error, beego
would give up on parsing app.conf and not log anything to the
console.
This commit is contained in:
Ryan A. Chapman 2015-11-29 15:09:28 -07:00
parent 2c94d9eab2
commit 7151b96465

View File

@ -354,10 +354,12 @@ func init() {
SetLogFuncCall(true) SetLogFuncCall(true)
err = ParseConfig() err = ParseConfig()
if err != nil && os.IsNotExist(err) { if err != nil {
if os.IsNotExist(err) {
// for init if doesn't have app.conf will not panic // for init if doesn't have app.conf will not panic
ac := config.NewFakeConfig() ac := config.NewFakeConfig()
AppConfig = &beegoAppConfig{ac} AppConfig = &beegoAppConfig{ac}
}
Warning(err) Warning(err)
} }
} }