mirror of
https://github.com/spf13/viper
synced 2024-11-04 20:27:02 +00:00
Revert "Recursively insensitivize the configuration structures"
This reverts commit 8d9577a72e
.
The commit is reasonable enough, but this is a major breaking change for Hugo.
We have to figure out how to handle this before we introduce this one.
See https://github.com/spf13/hugo/issues/1129
This commit is contained in:
parent
2e47d9ed4a
commit
be782f3fee
2 changed files with 3 additions and 8 deletions
5
util.go
5
util.go
|
@ -17,7 +17,6 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
@ -36,10 +35,6 @@ func insensitiviseMap(m map[string]interface{}) {
|
||||||
delete(m, key)
|
delete(m, key)
|
||||||
m[lower] = val
|
m[lower] = val
|
||||||
}
|
}
|
||||||
|
|
||||||
if val != nil && reflect.TypeOf(val).Kind() == reflect.Map {
|
|
||||||
insensitiviseMap(cast.ToStringMap(val))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,7 @@ func TestAllKeys(t *testing.T) {
|
||||||
|
|
||||||
ks := sort.StringSlice{"title", "newkey", "owner", "name", "beard", "ppu", "batters", "hobbies", "clothing", "age", "hacker", "id", "type", "eyes", "p_id", "p_ppu", "p_batters.batter.type", "p_type", "p_name"}
|
ks := sort.StringSlice{"title", "newkey", "owner", "name", "beard", "ppu", "batters", "hobbies", "clothing", "age", "hacker", "id", "type", "eyes", "p_id", "p_ppu", "p_batters.batter.type", "p_type", "p_name"}
|
||||||
dob, _ := time.Parse(time.RFC3339, "1979-05-27T07:32:00Z")
|
dob, _ := time.Parse(time.RFC3339, "1979-05-27T07:32:00Z")
|
||||||
all := map[string]interface{}{"owner": map[string]interface{}{"organization": "MongoDB", "bio": "MongoDB Chief Developer Advocate & Hacker at Large", "dob": dob}, "title": "TOML Example", "ppu": 0.55, "eyes": "brown", "clothing": map[interface{}]interface{}{"trousers": "denim", "jacket": "leather"}, "id": "0001", "batters": map[string]interface{}{"batter": []interface{}{map[string]interface{}{"type": "Regular"}, map[string]interface{}{"type": "Chocolate"}, map[string]interface{}{"type": "Blueberry"}, map[string]interface{}{"type": "Devil's Food"}}}, "hacker": true, "beard": true, "hobbies": []interface{}{"skateboarding", "snowboarding", "go"}, "age": 35, "type": "donut", "newkey": "remote", "name": "Cake", "p_id": "0001", "p_ppu": "0.55", "p_name": "Cake", "p_batters.batter.type": "Regular", "p_type": "donut"}
|
all := map[string]interface{}{"owner": map[string]interface{}{"organization": "MongoDB", "Bio": "MongoDB Chief Developer Advocate & Hacker at Large", "dob": dob}, "title": "TOML Example", "ppu": 0.55, "eyes": "brown", "clothing": map[interface{}]interface{}{"trousers": "denim", "jacket": "leather"}, "id": "0001", "batters": map[string]interface{}{"batter": []interface{}{map[string]interface{}{"type": "Regular"}, map[string]interface{}{"type": "Chocolate"}, map[string]interface{}{"type": "Blueberry"}, map[string]interface{}{"type": "Devil's Food"}}}, "hacker": true, "beard": true, "hobbies": []interface{}{"skateboarding", "snowboarding", "go"}, "age": 35, "type": "donut", "newkey": "remote", "name": "Cake", "p_id": "0001", "p_ppu": "0.55", "p_name": "Cake", "p_batters.batter.type": "Regular", "p_type": "donut"}
|
||||||
|
|
||||||
var allkeys sort.StringSlice
|
var allkeys sort.StringSlice
|
||||||
allkeys = AllKeys()
|
allkeys = AllKeys()
|
||||||
|
@ -512,10 +512,10 @@ func TestFindsNestedKeys(t *testing.T) {
|
||||||
"age": 35,
|
"age": 35,
|
||||||
"owner": map[string]interface{}{
|
"owner": map[string]interface{}{
|
||||||
"organization": "MongoDB",
|
"organization": "MongoDB",
|
||||||
"bio": "MongoDB Chief Developer Advocate & Hacker at Large",
|
"Bio": "MongoDB Chief Developer Advocate & Hacker at Large",
|
||||||
"dob": dob,
|
"dob": dob,
|
||||||
},
|
},
|
||||||
"owner.bio": "MongoDB Chief Developer Advocate & Hacker at Large",
|
"owner.Bio": "MongoDB Chief Developer Advocate & Hacker at Large",
|
||||||
"type": "donut",
|
"type": "donut",
|
||||||
"id": "0001",
|
"id": "0001",
|
||||||
"name": "Cake",
|
"name": "Cake",
|
||||||
|
|
Loading…
Reference in a new issue