1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-16 13:20:54 +00:00

Merge pull request #849 from pabdavis/runmode-env

Support run mode set by environment variable
This commit is contained in:
astaxie 2014-10-10 00:50:16 +08:00
commit 2823167848

View File

@ -288,8 +288,11 @@ func init() {
func ParseConfig() (err error) {
AppConfig = newAppConfig(AppConfigProvider, AppConfigPath)
envRunMode := os.Getenv("BEEGO_RUNMODE")
// set the runmode first
if runmode := AppConfig.String("RunMode"); runmode != "" {
if envRunMode != "" {
RunMode = envRunMode
} else if runmode := AppConfig.String("RunMode"); runmode != "" {
RunMode = runmode
}