isPathShadowedInAutoEnv makes sure the given path is not shadowed somewhere in the environment, when automatic env is on. e.g., if "foo.bar" has a value in the environment, it “shadows” "foo.bar.baz" in a lower-priority map
(path []string)
| 669 | // |
| 670 | // "foo.bar.baz" in a lower-priority map |
| 671 | func (v *Viper) isPathShadowedInAutoEnv(path []string) string { |
| 672 | var parentKey string |
| 673 | for i := 1; i < len(path); i++ { |
| 674 | parentKey = strings.Join(path[0:i], v.keyDelim) |
| 675 | if _, ok := v.getEnv(v.mergeWithEnvPrefix(parentKey)); ok { |
| 676 | return parentKey |
| 677 | } |
| 678 | } |
| 679 | return "" |
| 680 | } |
| 681 | |
| 682 | // SetTypeByDefaultValue enables or disables the inference of a key value's |
| 683 | // type when the Get function is used based upon a key's default value as |
no test coverage detected