mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 12:50:55 +00:00
Add host env feature.
This commit is contained in:
parent
c5118e9535
commit
b9c8c08c03
11
config.go
11
config.go
@ -134,9 +134,16 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
appConfigPath = filepath.Join(workPath, "conf", "app.conf")
|
var confFile = "app."
|
||||||
|
var hostEnv = os.Getenv("BEEGO_ENV")
|
||||||
|
if (len(hostEnv) != 0){
|
||||||
|
confFile += hostEnv+".conf"
|
||||||
|
}else{
|
||||||
|
confFile += "conf"
|
||||||
|
}
|
||||||
|
appConfigPath = filepath.Join(workPath, "conf", confFile)
|
||||||
if !utils.FileExists(appConfigPath) {
|
if !utils.FileExists(appConfigPath) {
|
||||||
appConfigPath = filepath.Join(AppPath, "conf", "app.conf")
|
appConfigPath = filepath.Join(AppPath, "conf", confFile)
|
||||||
if !utils.FileExists(appConfigPath) {
|
if !utils.FileExists(appConfigPath) {
|
||||||
AppConfig = &beegoAppConfig{innerConfig: config.NewFakeConfig()}
|
AppConfig = &beegoAppConfig{innerConfig: config.NewFakeConfig()}
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user