mirror of
https://github.com/spf13/viper
synced 2024-12-22 03:27:03 +00:00
Fixing case sensitivity bug with override values
This commit is contained in:
parent
16d5c7c27d
commit
541c1f8c59
2 changed files with 6 additions and 1 deletions
3
viper.go
3
viper.go
|
@ -193,7 +193,6 @@ func SetDefault(key string, value interface{}) {
|
|||
func Set(key string, value interface{}) {
|
||||
// If alias passed in, then set the proper override
|
||||
key = realKey(strings.ToLower(key))
|
||||
key = strings.ToLower(key)
|
||||
override[key] = value
|
||||
}
|
||||
|
||||
|
@ -392,6 +391,8 @@ func Debug() {
|
|||
pretty.Println(defaults)
|
||||
fmt.Println("Override:")
|
||||
pretty.Println(override)
|
||||
fmt.Println("Aliases:")
|
||||
pretty.Println(aliases)
|
||||
}
|
||||
|
||||
func Reset() {
|
||||
|
|
|
@ -18,6 +18,9 @@ hobbies:
|
|||
- skateboarding
|
||||
- snowboarding
|
||||
- go
|
||||
clothing:
|
||||
jacket: leather
|
||||
trousers: denim
|
||||
age: 35`)
|
||||
|
||||
var tomlExample = []byte(`
|
||||
|
@ -62,6 +65,7 @@ func TestMarshalling(t *testing.T) {
|
|||
assert.False(t, InConfig("state"))
|
||||
assert.Equal(t, "steve", Get("name"))
|
||||
assert.Equal(t, []interface{}{"skateboarding", "snowboarding", "go"}, Get("hobbies"))
|
||||
assert.Equal(t, map[interface{}]interface{}{"jacket": "leather", "trousers": "denim"}, Get("clothing"))
|
||||
assert.Equal(t, 35, Get("age"))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue