diff --git a/internal/vault.go b/internal/vault.go index 9def58e..db71b10 100644 --- a/internal/vault.go +++ b/internal/vault.go @@ -31,17 +31,17 @@ func (v vault) Store(msg string, ttl string) (token string, err error) { // Default TTL if ttl == "" { ttl = "48h" - } - - // Verify duration - d, err := time.ParseDuration(ttl) - if err != nil { - return "", fmt.Errorf("cannot parse duration %v", err) - } + } else { + // Verify duration + d, err := time.ParseDuration(ttl) + if err != nil { + return "", fmt.Errorf("cannot parse duration %v", err) + } - // validate duration length - if d > 168*time.Hour || d == 0*time.Hour { - return "", fmt.Errorf("cannot set ttl to infinte or more than 7 days %v", err) + // validate duration length + if d > 168*time.Hour || d == 0*time.Hour { + return "", fmt.Errorf("cannot set ttl to infinte or more than 7 days %v", err) + } } t, err := v.createOneTimeToken(ttl)