Codebase list golang-github-spf13-viper / 266e588
Add string slice support to defaultDecoderConfig This way it correctly decodes string slices as well. Alexander Krasnukhin authored 7 years ago Bjørn Erik Pedersen committed 6 years ago
1 changed file(s) with 5 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
746746 }
747747
748748 // defaultDecoderConfig returns default mapsstructure.DecoderConfig with suppot
749 // of time.Duration values
749 // of time.Duration values & string slices
750750 func defaultDecoderConfig(output interface{}) *mapstructure.DecoderConfig {
751751 return &mapstructure.DecoderConfig{
752752 Metadata: nil,
753753 Result: output,
754754 WeaklyTypedInput: true,
755 DecodeHook: mapstructure.StringToTimeDurationHookFunc(),
755 DecodeHook: mapstructure.ComposeDecodeHookFunc(
756 mapstructure.StringToTimeDurationHookFunc(),
757 mapstructure.StringToSliceHookFunc(","),
758 ),
756759 }
757760 }
758761