Commit caa404ce authored by astaxie's avatar astaxie

Merge pull request #1840 from youngsterxyf/develop

To support `go run`
parents 52fbab32 e281b6e8
......@@ -116,10 +116,6 @@ var (
)
func init() {
AppPath, _ = filepath.Abs(filepath.Dir(os.Args[0]))
os.Chdir(AppPath)
BConfig = &Config{
AppName: "beego",
RunMode: DEV,
......@@ -180,13 +176,26 @@ func init() {
},
}
appConfigPath = filepath.Join(AppPath, "conf", "app.conf")
var err error
if AppPath, err = filepath.Abs(filepath.Dir(os.Args[0])); err != nil {
panic(err)
}
workPath, err := os.Getwd()
if err != nil {
panic(err)
}
appConfigPath = filepath.Join(workPath, "conf", "app.conf")
if !utils.FileExists(appConfigPath) {
AppConfig = &beegoAppConfig{innerConfig: config.NewFakeConfig()}
return
appConfigPath = filepath.Join(AppPath, "conf", "app.conf")
if !utils.FileExists(appConfigPath) {
AppConfig = &beegoAppConfig{innerConfig: config.NewFakeConfig()}
return
}
}
if err := parseConfig(appConfigPath); err != nil {
if err = parseConfig(appConfigPath); err != nil {
panic(err)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment