1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-06 01:50:19 +00:00

Update config suport environment variable logic

This commit is contained in:
ysqi
2016-03-12 14:32:39 +08:00
parent 86c7f1db9e
commit b2a06c5fa0
10 changed files with 240 additions and 219 deletions

View File

@ -57,6 +57,9 @@ func (js *JSONConfig) ParseData(data []byte) (Configer, error) {
}
x.data["rootArray"] = wrappingArray
}
x.data = ChooseRealValueForMap(x.data)
return x, nil
}
@ -250,18 +253,11 @@ func (c *JSONConfigContainer) getData(key string) interface{} {
}
}
}
if env, ok := Getenv(curValue); ok {
return env
}
return curValue
}
if v, ok := c.data[key]; ok {
if env, ok := Getenv(v); ok {
return env
}
return v
}
return nil
}