replacer: Add HTTP time format (#5458)

This commit is contained in:
Francis Lavoie 2023-03-27 16:51:13 -04:00 committed by GitHub
parent 10b265d252
commit f5a13a4ab4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,7 @@ package caddy
import (
"fmt"
"net/http"
"os"
"path/filepath"
"runtime"
@ -316,6 +317,8 @@ func globalDefaultReplacements(key string) (any, bool) {
return runtime.GOARCH, true
case "time.now":
return nowFunc(), true
case "time.now.http":
return nowFunc().Format(http.TimeFormat), true
case "time.now.common_log":
return nowFunc().Format("02/Jan/2006:15:04:05 -0700"), true
case "time.now.year":