mirror of
https://github.com/caddyserver/caddy.git
synced 2025-12-08 06:09:53 +00:00
Miscellaneous cleanups / comments
This commit is contained in:
parent
5300949e0d
commit
9c0bf311f9
8 changed files with 56 additions and 9 deletions
|
|
@ -19,6 +19,7 @@ import (
|
|||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Replacer can replace values in strings.
|
||||
|
|
@ -156,11 +157,17 @@ func globalDefaultReplacements(key string) (string, bool) {
|
|||
return runtime.GOOS, true
|
||||
case "system.arch":
|
||||
return runtime.GOARCH, true
|
||||
case "time.now.common_log":
|
||||
return nowFunc().Format("02/Jan/2006:15:04:05 -0700"), true
|
||||
}
|
||||
|
||||
return "", false
|
||||
}
|
||||
|
||||
// nowFunc is a variable so tests can change it
|
||||
// in order to obtain a deterministic time.
|
||||
var nowFunc = time.Now
|
||||
|
||||
// ReplacerCtxKey is the context key for a replacer.
|
||||
const ReplacerCtxKey CtxKey = "replacer"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue