mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 13:40:55 +00:00
Add host env feature.
This commit is contained in:
parent
b9c8c08c03
commit
229d8b9530
15
config.go
15
config.go
@ -134,16 +134,13 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
var confFile = "app."
|
var filename = "app.conf"
|
||||||
var hostEnv = os.Getenv("BEEGO_ENV")
|
if os.Getenv("BEEGO_MODE") !=""{
|
||||||
if (len(hostEnv) != 0){
|
filename= os.Getenv("BEEGO_MODE")+".app.conf"
|
||||||
confFile += hostEnv+".conf"
|
}
|
||||||
}else{
|
appConfigPath = filepath.Join(workPath, "conf", filename)
|
||||||
confFile += "conf"
|
|
||||||
}
|
|
||||||
appConfigPath = filepath.Join(workPath, "conf", confFile)
|
|
||||||
if !utils.FileExists(appConfigPath) {
|
if !utils.FileExists(appConfigPath) {
|
||||||
appConfigPath = filepath.Join(AppPath, "conf", confFile)
|
appConfigPath = filepath.Join(AppPath, "conf", filename)
|
||||||
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