From 229d8b953033add2508dde6b8c14ff5b8f4bf044 Mon Sep 17 00:00:00 2001 From: Abel Date: Mon, 30 Oct 2017 13:54:36 +0800 Subject: [PATCH] Add host env feature. --- config.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/config.go b/config.go index 4598bda5..d51a1665 100644 --- a/config.go +++ b/config.go @@ -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