mirror of
https://github.com/spf13/viper
synced 2025-05-11 22:57:21 +00:00
Merge 0939e4373c
into 2062cd6ee6
This commit is contained in:
commit
4e7fc67b9d
2 changed files with 3 additions and 2 deletions
4
viper.go
4
viper.go
|
@ -1405,9 +1405,9 @@ func InConfig(key string) bool { return v.InConfig(key) }
|
|||
|
||||
func (v *Viper) InConfig(key string) bool {
|
||||
// if the requested key is an alias, then return the proper key
|
||||
key = v.realKey(key)
|
||||
key = v.realKey(strings.ToLower(key))
|
||||
|
||||
_, exists := v.config[key]
|
||||
_, exists := v.config[strings.ToLower(key)]
|
||||
return exists
|
||||
}
|
||||
|
||||
|
|
|
@ -382,6 +382,7 @@ func TestUnmarshaling(t *testing.T) {
|
|||
|
||||
unmarshalReader(r, v.config)
|
||||
assert.True(t, InConfig("name"))
|
||||
assert.True(t, InConfig("NAME"))
|
||||
assert.False(t, InConfig("state"))
|
||||
assert.Equal(t, "steve", Get("name"))
|
||||
assert.Equal(t, []interface{}{"skateboarding", "snowboarding", "go"}, Get("hobbies"))
|
||||
|
|
Loading…
Add table
Reference in a new issue