From b9c8c08c035ff61ae95f4d776f585cf569129592 Mon Sep 17 00:00:00 2001 From: Abel Date: Thu, 26 Oct 2017 19:25:05 +0800 Subject: [PATCH] Add host env feature. --- config.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/config.go b/config.go index e6e99570..4598bda5 100644 --- a/config.go +++ b/config.go @@ -134,9 +134,16 @@ func init() { if err != nil { 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) { - appConfigPath = filepath.Join(AppPath, "conf", "app.conf") + appConfigPath = filepath.Join(AppPath, "conf", confFile) if !utils.FileExists(appConfigPath) { AppConfig = &beegoAppConfig{innerConfig: config.NewFakeConfig()} return