1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-08 06:13:31 +00:00

Merge pull request #3263 from guomao545/master

Support return middle level value
This commit is contained in:
astaxie 2018-07-30 12:27:05 +08:00 committed by GitHub
commit 42c394e28b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -290,12 +290,15 @@ func (c *ConfigContainer) getData(key string) (interface{}, error) {
keys := strings.Split(key, ".") keys := strings.Split(key, ".")
tmpData := c.data tmpData := c.data
for _, k := range keys { for idx, k := range keys {
if v, ok := tmpData[k]; ok { if v, ok := tmpData[k]; ok {
switch v.(type) { switch v.(type) {
case map[string]interface{}: case map[string]interface{}:
{ {
tmpData = v.(map[string]interface{}) tmpData = v.(map[string]interface{})
if idx == len(keys) - 1 {
return tmpData, nil
}
} }
default: default:
{ {