mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 14:00:54 +00:00
improve
This commit is contained in:
parent
561e7115f3
commit
e281b6e82a
19
config.go
19
config.go
@ -106,8 +106,6 @@ var (
|
|||||||
AppConfig *beegoAppConfig
|
AppConfig *beegoAppConfig
|
||||||
// AppPath is the absolute path to the app
|
// AppPath is the absolute path to the app
|
||||||
AppPath string
|
AppPath string
|
||||||
// workPath is the absolute path of the current dir
|
|
||||||
workPath string
|
|
||||||
// GlobalSessions is the instance for the session manager
|
// GlobalSessions is the instance for the session manager
|
||||||
GlobalSessions *session.Manager
|
GlobalSessions *session.Manager
|
||||||
|
|
||||||
@ -118,11 +116,6 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
AppPath, _ = filepath.Abs(filepath.Dir(os.Args[0]))
|
|
||||||
|
|
||||||
workPath, _ = os.Getwd()
|
|
||||||
workPath, _ = filepath.Abs(workPath)
|
|
||||||
|
|
||||||
BConfig = &Config{
|
BConfig = &Config{
|
||||||
AppName: "beego",
|
AppName: "beego",
|
||||||
RunMode: DEV,
|
RunMode: DEV,
|
||||||
@ -183,6 +176,16 @@ func init() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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")
|
appConfigPath = filepath.Join(workPath, "conf", "app.conf")
|
||||||
if !utils.FileExists(appConfigPath) {
|
if !utils.FileExists(appConfigPath) {
|
||||||
appConfigPath = filepath.Join(AppPath, "conf", "app.conf")
|
appConfigPath = filepath.Join(AppPath, "conf", "app.conf")
|
||||||
@ -192,7 +195,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := parseConfig(appConfigPath); err != nil {
|
if err = parseConfig(appConfigPath); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user