forked from mirror/viper
AllKeys() now includes bound flag and env var keys
This patch fixes a bug where the function `AllKeys()` did not include the keys for bound flags and environment variables.
This commit is contained in:
parent
e37b56e207
commit
c25387f10d
16
viper.go
16
viper.go
|
@ -962,19 +962,27 @@ func (v *Viper) AllKeys() []string {
|
||||||
m := map[string]struct{}{}
|
m := map[string]struct{}{}
|
||||||
|
|
||||||
for key, _ := range v.defaults {
|
for key, _ := range v.defaults {
|
||||||
m[key] = struct{}{}
|
m[strings.ToLower(key)] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, _ := range v.pflags {
|
||||||
|
m[strings.ToLower(key)] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, _ := range v.env {
|
||||||
|
m[strings.ToLower(key)] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, _ := range v.config {
|
for key, _ := range v.config {
|
||||||
m[key] = struct{}{}
|
m[strings.ToLower(key)] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, _ := range v.kvstore {
|
for key, _ := range v.kvstore {
|
||||||
m[key] = struct{}{}
|
m[strings.ToLower(key)] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, _ := range v.override {
|
for key, _ := range v.override {
|
||||||
m[key] = struct{}{}
|
m[strings.ToLower(key)] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
a := []string{}
|
a := []string{}
|
||||||
|
|
Loading…
Reference in New Issue