core: Add support for d duration unit (#3323)

* caddy: Add support for `d` duration unit

* Improvements to ParseDuration; add unit tests

Co-authored-by: Matthew Holt <mholt@users.noreply.github.com>
This commit is contained in:
Francis Lavoie
2020-05-11 18:41:11 -04:00
committed by GitHub
parent 35e1d92d58
commit ef6e53bb5f
7 changed files with 167 additions and 18 deletions

View File

@@ -311,7 +311,7 @@ func (f Flags) Float64(name string) float64 {
// is not a duration type. It panics if the flag is
// not in the flag set.
func (f Flags) Duration(name string) time.Duration {
val, _ := time.ParseDuration(f.String(name))
val, _ := caddy.ParseDuration(f.String(name))
return val
}