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
746 | 746 | } |
747 | 747 | |
748 | 748 | // defaultDecoderConfig returns default mapsstructure.DecoderConfig with suppot |
749 | // of time.Duration values | |
749 | // of time.Duration values & string slices | |
750 | 750 | func defaultDecoderConfig(output interface{}) *mapstructure.DecoderConfig { |
751 | 751 | return &mapstructure.DecoderConfig{ |
752 | 752 | Metadata: nil, |
753 | 753 | Result: output, |
754 | 754 | WeaklyTypedInput: true, |
755 | DecodeHook: mapstructure.StringToTimeDurationHookFunc(), | |
755 | DecodeHook: mapstructure.ComposeDecodeHookFunc( | |
756 | mapstructure.StringToTimeDurationHookFunc(), | |
757 | mapstructure.StringToSliceHookFunc(","), | |
758 | ), | |
756 | 759 | } |
757 | 760 | } |
758 | 761 |