mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 06:03:48 +03:00
replacer: Add HTTP time format (#5458)
This commit is contained in:
parent
10b265d252
commit
f5a13a4ab4
1 changed files with 3 additions and 0 deletions
|
@ -16,6 +16,7 @@ package caddy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
@ -316,6 +317,8 @@ func globalDefaultReplacements(key string) (any, bool) {
|
||||||
return runtime.GOARCH, true
|
return runtime.GOARCH, true
|
||||||
case "time.now":
|
case "time.now":
|
||||||
return nowFunc(), true
|
return nowFunc(), true
|
||||||
|
case "time.now.http":
|
||||||
|
return nowFunc().Format(http.TimeFormat), true
|
||||||
case "time.now.common_log":
|
case "time.now.common_log":
|
||||||
return nowFunc().Format("02/Jan/2006:15:04:05 -0700"), true
|
return nowFunc().Format("02/Jan/2006:15:04:05 -0700"), true
|
||||||
case "time.now.year":
|
case "time.now.year":
|
||||||
|
|
Loading…
Reference in a new issue