@marcel91200 / caddy Mirror · read-only / commits / 5e5af50e
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 01:30 UTC

caddyfile: make renew_interval option configurable (#4451)

Rainer Borene committed Nov 28, 2021 at 19:22 UTC 5e5af50e64a33ecd9c91aaa773d4f8428945ac74
3 files changed +11
caddyconfig/httpcaddyfile/options.go
+1
@@ -34,6 +34,7 @@ func init() {
34 RegisterGlobalOption("order", parseOptOrder)
35 RegisterGlobalOption("storage", parseOptStorage)
36 RegisterGlobalOption("storage_clean_interval", parseOptDuration)
37 + RegisterGlobalOption("renew_interval", parseOptDuration)
38 RegisterGlobalOption("acme_ca", parseOptSingleString)
39 RegisterGlobalOption("acme_ca_root", parseOptSingleString)
40 RegisterGlobalOption("acme_dns", parseOptACMEDNS)
caddyconfig/httpcaddyfile/tlsapp.go
+8
@@ -286,6 +286,14 @@ func (st ServerType) buildTLSApp(
286 tlsApp.Automation.StorageCleanInterval = storageCleanInterval
287 }
288
289 + // set the expired certificates renew interval if configured
290 + if renewCheckInterval, ok := options["renew_interval"].(caddy.Duration); ok {
291 + if tlsApp.Automation == nil {
292 + tlsApp.Automation = new(caddytls.AutomationConfig)
293 + }
294 + tlsApp.Automation.RenewCheckInterval = renewCheckInterval
295 + }
296 +
297 // if any hostnames appear on the same server block as a key with
298 // no host, they will not be used with route matchers because the
299 // hostless key matches all hosts, therefore, it wouldn't be
caddytest/integration/caddyfile_adapt/global_options_acme.txt
+2
@@ -21,6 +21,7 @@
21 burst 20
22 }
23 storage_clean_interval 7d
24 + renew_interval 1d
25
26 key_type ed25519
27 }
@@ -82,6 +83,7 @@
83 },
84 "ask": "https://example.com"
85 },
86 + "renew_interval": 86400000000000,
87 "storage_clean_interval": 604800000000000
88 }
89 }