mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-29 23:25:50 +08:00
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:
@ -489,3 +489,53 @@ func TestGlobalOptions(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
}
|
||||
|
||||
func TestLogRollDays(t *testing.T) {
|
||||
caddytest.AssertAdapt(t, `
|
||||
:80
|
||||
|
||||
log {
|
||||
output file /var/log/access.log {
|
||||
roll_size 1gb
|
||||
roll_keep 5
|
||||
roll_keep_for 90d
|
||||
}
|
||||
}
|
||||
`, "caddyfile", `{
|
||||
"logging": {
|
||||
"logs": {
|
||||
"default": {
|
||||
"exclude": [
|
||||
"http.log.access.log0"
|
||||
]
|
||||
},
|
||||
"log0": {
|
||||
"writer": {
|
||||
"filename": "/var/log/access.log",
|
||||
"output": "file",
|
||||
"roll_keep": 5,
|
||||
"roll_keep_days": 90,
|
||||
"roll_size_mb": 954
|
||||
},
|
||||
"include": [
|
||||
"http.log.access.log0"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"apps": {
|
||||
"http": {
|
||||
"servers": {
|
||||
"srv0": {
|
||||
"listen": [
|
||||
":80"
|
||||
],
|
||||
"logs": {
|
||||
"default_logger_name": "log0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`)
|
||||
}
|
||||
|
Reference in New Issue
Block a user