1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-23 06:10:51 +00:00

Add host env feature.

This commit is contained in:
Abel 2017-10-30 13:54:36 +08:00
parent b9c8c08c03
commit 229d8b9530

View File

@ -134,16 +134,13 @@ func init() {
if err != nil {
panic(err)
}
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)
var filename = "app.conf"
if os.Getenv("BEEGO_MODE") !=""{
filename= os.Getenv("BEEGO_MODE")+".app.conf"
}
appConfigPath = filepath.Join(workPath, "conf", filename)
if !utils.FileExists(appConfigPath) {
appConfigPath = filepath.Join(AppPath, "conf", confFile)
appConfigPath = filepath.Join(AppPath, "conf", filename)
if !utils.FileExists(appConfigPath) {
AppConfig = &beegoAppConfig{innerConfig: config.NewFakeConfig()}
return