mergeFlatMap merges the given maps, excluding values of the second map shadowed by values from the first map.
(shadow map[string]bool, m map[string]any)
| 1945 | // mergeFlatMap merges the given maps, excluding values of the second map |
| 1946 | // shadowed by values from the first map. |
| 1947 | func (v *Viper) mergeFlatMap(shadow map[string]bool, m map[string]any) map[string]bool { |
| 1948 | // scan keys |
| 1949 | outer: |
| 1950 | for k := range m { |
| 1951 | path := strings.Split(k, v.keyDelim) |
| 1952 | // scan intermediate paths |
| 1953 | var parentKey string |
| 1954 | for i := 1; i < len(path); i++ { |
| 1955 | parentKey = strings.Join(path[0:i], v.keyDelim) |
| 1956 | if shadow[parentKey] { |
| 1957 | // path is shadowed, continue |
| 1958 | continue outer |
| 1959 | } |
| 1960 | } |
| 1961 | // add key |
| 1962 | shadow[strings.ToLower(k)] = true |
| 1963 | } |
| 1964 | return shadow |
| 1965 | } |
| 1966 | |
| 1967 | // AllSettings merges all settings and returns them as a map[string]any. |
| 1968 | func AllSettings() map[string]any { return v.AllSettings() } |