diff options
Diffstat (limited to 'internal/configuration/decode_hooks.go')
| -rw-r--r-- | internal/configuration/decode_hooks.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/internal/configuration/decode_hooks.go b/internal/configuration/decode_hooks.go index f8ce99f6a..939347639 100644 --- a/internal/configuration/decode_hooks.go +++ b/internal/configuration/decode_hooks.go @@ -67,7 +67,11 @@ func ToTimeDurationFunc() mapstructure.DecodeHookFuncType { switch { case f.Kind() == reflect.String: - break + dataStr := data.(string) + + if duration, err = utils.ParseDurationString(dataStr); err != nil { + return nil, err + } case f.Kind() == reflect.Int: seconds := data.(int) @@ -84,14 +88,6 @@ func ToTimeDurationFunc() mapstructure.DecodeHookFuncType { duration = time.Second * time.Duration(seconds) } - if duration == 0 { - dataStr := data.(string) - - if duration, err = utils.ParseDurationString(dataStr); err != nil { - return nil, err - } - } - if ptr { return &duration, nil } |
