mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 06:41:29 +00:00
commit
caa404cec1
27
config.go
27
config.go
@ -116,10 +116,6 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
AppPath, _ = filepath.Abs(filepath.Dir(os.Args[0]))
|
|
||||||
|
|
||||||
os.Chdir(AppPath)
|
|
||||||
|
|
||||||
BConfig = &Config{
|
BConfig = &Config{
|
||||||
AppName: "beego",
|
AppName: "beego",
|
||||||
RunMode: DEV,
|
RunMode: DEV,
|
||||||
@ -180,13 +176,26 @@ func init() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
appConfigPath = filepath.Join(AppPath, "conf", "app.conf")
|
var err error
|
||||||
if !utils.FileExists(appConfigPath) {
|
|
||||||
AppConfig = &beegoAppConfig{innerConfig: config.NewFakeConfig()}
|
if AppPath, err = filepath.Abs(filepath.Dir(os.Args[0])); err != nil {
|
||||||
return
|
panic(err)
|
||||||
|
}
|
||||||
|
workPath, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := parseConfig(appConfigPath); err != nil {
|
appConfigPath = filepath.Join(workPath, "conf", "app.conf")
|
||||||
|
if !utils.FileExists(appConfigPath) {
|
||||||
|
appConfigPath = filepath.Join(AppPath, "conf", "app.conf")
|
||||||
|
if !utils.FileExists(appConfigPath) {
|
||||||
|
AppConfig = &beegoAppConfig{innerConfig: config.NewFakeConfig()}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = parseConfig(appConfigPath); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user