Unverified Commit 39fc30b8 authored by guomao545's avatar guomao545 Committed by GitHub

Support return middle level value

fix multilevel yaml config can't correct return middle level value bug
parent a09bafbf
...@@ -290,12 +290,15 @@ func (c *ConfigContainer) getData(key string) (interface{}, error) { ...@@ -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:
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment