|
|
@@ -29,8 +29,8 @@ func (conf *Configer) getData(item string) (ch ConfigerChannelInterface, err err |
|
|
|
env := os.Getenv("CENTER_RUNMODE") |
|
|
|
chunks := strings.SplitN(item, ".", 2) |
|
|
|
|
|
|
|
if len(chunks) < 2 { |
|
|
|
panic("Item string error") |
|
|
|
if len(chunks) < 1 { |
|
|
|
panic("Item string error chunk len must more than 1") |
|
|
|
} |
|
|
|
|
|
|
|
if strings.TrimSpace(env) == "" { |
|
|
@@ -82,6 +82,10 @@ func (conf *Configer) String(item string) string { |
|
|
|
|
|
|
|
func recursiveParse(item string, v interface{}) interface{} { |
|
|
|
|
|
|
|
if item == "" { |
|
|
|
return v |
|
|
|
} |
|
|
|
|
|
|
|
chunks := strings.SplitN(item, ".", 2) |
|
|
|
|
|
|
|
if n, err := strconv.Atoi(chunks[0]); err == nil { |
|
|
@@ -90,7 +94,6 @@ func recursiveParse(item string, v interface{}) interface{} { |
|
|
|
v = tmp[n] |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
if tmp, ok := v.(map[interface{}]interface{}); reflect.TypeOf(v).Kind() == reflect.Map && ok { |
|
|
|
v = tmp[chunks[0]] |
|
|
|
} |
|
|
|