mirror of
https://github.com/astaxie/beego.git
synced 2024-12-22 17:30:50 +00:00
Support return middle level value
fix multilevel yaml config can't correct return middle level value bug
This commit is contained in:
parent
a09bafbf2a
commit
39fc30b8b2
@ -290,12 +290,15 @@ func (c *ConfigContainer) getData(key string) (interface{}, error) {
|
||||
|
||||
keys := strings.Split(key, ".")
|
||||
tmpData := c.data
|
||||
for _, k := range keys {
|
||||
for idx, k := range keys {
|
||||
if v, ok := tmpData[k]; ok {
|
||||
switch v.(type) {
|
||||
case map[string]interface{}:
|
||||
{
|
||||
tmpData = v.(map[string]interface{})
|
||||
if idx == len(keys) - 1 {
|
||||
return tmpData, nil
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user