diff options
author | Francis Lavoie <[email protected]> | 2021-05-02 13:57:28 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-02 11:57:28 -0600 |
commit | 6e0e3e1537c399faabd30cc08a9fe68a7be87639 (patch) | |
tree | 27e7ba701584c60d3b9e1ed857ab3203fd6bd7c0 /caddyconfig/httpcaddyfile/options.go | |
parent | 53ececda21f77d000ee893bc981d6ec5c33872f8 (diff) | |
download | caddy-6e0e3e1537c399faabd30cc08a9fe68a7be87639.tar.gz caddy-6e0e3e1537c399faabd30cc08a9fe68a7be87639.zip |
httpcaddyfile: Add global option for `storage_clean_interval` (#4134)
Followup to https://github.com/caddyserver/caddy/commit/42b7134ffa3bf3e9e86514c82407979c2627a5ab
Diffstat (limited to 'caddyconfig/httpcaddyfile/options.go')
-rw-r--r-- | caddyconfig/httpcaddyfile/options.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/caddyconfig/httpcaddyfile/options.go b/caddyconfig/httpcaddyfile/options.go index 9dd215f97..799b08819 100644 --- a/caddyconfig/httpcaddyfile/options.go +++ b/caddyconfig/httpcaddyfile/options.go @@ -32,6 +32,7 @@ func init() { RegisterGlobalOption("default_sni", parseOptSingleString) RegisterGlobalOption("order", parseOptOrder) RegisterGlobalOption("storage", parseOptStorage) + RegisterGlobalOption("storage_clean_interval", parseOptStorageCleanInterval) RegisterGlobalOption("acme_ca", parseOptSingleString) RegisterGlobalOption("acme_ca_root", parseOptSingleString) RegisterGlobalOption("acme_dns", parseOptACMEDNS) @@ -177,6 +178,20 @@ func parseOptStorage(d *caddyfile.Dispenser, _ interface{}) (interface{}, error) return storage, nil } +func parseOptStorageCleanInterval(d *caddyfile.Dispenser, _ interface{}) (interface{}, error) { + if !d.Next() { // consume option name + return nil, d.ArgErr() + } + if !d.Next() { // get duration value + return nil, d.ArgErr() + } + dur, err := caddy.ParseDuration(d.Val()) + if err != nil { + return nil, err + } + return caddy.Duration(dur), nil +} + func parseOptACMEDNS(d *caddyfile.Dispenser, _ interface{}) (interface{}, error) { if !d.Next() { // consume option name return nil, d.ArgErr() |