mirror of
https://github.com/spf13/viper
synced 2025-05-07 12:47:18 +00:00
Use 'viper' as decoder tag name
This commit is contained in:
parent
aafc9e6bc7
commit
4a90d8c3a8
2 changed files with 2 additions and 1 deletions
|
@ -579,7 +579,7 @@ Example:
|
||||||
type config struct {
|
type config struct {
|
||||||
Port int
|
Port int
|
||||||
Name string
|
Name string
|
||||||
PathMap string `mapstructure:"path_map"`
|
PathMap string `viper:"path_map"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var C config
|
var C config
|
||||||
|
|
1
viper.go
1
viper.go
|
@ -774,6 +774,7 @@ func defaultDecoderConfig(output interface{}) *mapstructure.DecoderConfig {
|
||||||
Metadata: nil,
|
Metadata: nil,
|
||||||
Result: output,
|
Result: output,
|
||||||
WeaklyTypedInput: true,
|
WeaklyTypedInput: true,
|
||||||
|
TagName: "viper",
|
||||||
DecodeHook: mapstructure.ComposeDecodeHookFunc(
|
DecodeHook: mapstructure.ComposeDecodeHookFunc(
|
||||||
mapstructure.StringToTimeDurationHookFunc(),
|
mapstructure.StringToTimeDurationHookFunc(),
|
||||||
mapstructure.StringToSliceHookFunc(","),
|
mapstructure.StringToSliceHookFunc(","),
|
||||||
|
|
Loading…
Add table
Reference in a new issue