This commit is contained in:
Anton Prokhorov 2018-07-13 14:34:21 +00:00 committed by GitHub
commit 6367345ef9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -773,8 +773,8 @@ func (v *Viper) Unmarshal(rawVal interface{}) error {
return nil return nil
} }
// defaultDecoderConfig returns default mapsstructure.DecoderConfig with suppot // defaultDecoderConfig returns default mapsstructure.DecoderConfig with support
// of time.Duration values & string slices // of time.Duration and time.Time (RFC 3339) values and string slices
func defaultDecoderConfig(output interface{}) *mapstructure.DecoderConfig { func defaultDecoderConfig(output interface{}) *mapstructure.DecoderConfig {
return &mapstructure.DecoderConfig{ return &mapstructure.DecoderConfig{
Metadata: nil, Metadata: nil,
@ -782,6 +782,7 @@ func defaultDecoderConfig(output interface{}) *mapstructure.DecoderConfig {
WeaklyTypedInput: true, WeaklyTypedInput: true,
DecodeHook: mapstructure.ComposeDecodeHookFunc( DecodeHook: mapstructure.ComposeDecodeHookFunc(
mapstructure.StringToTimeDurationHookFunc(), mapstructure.StringToTimeDurationHookFunc(),
mapstructure.StringToTimeHookFunc(time.RFC3339),
mapstructure.StringToSliceHookFunc(","), mapstructure.StringToSliceHookFunc(","),
), ),
} }