summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Borene <rainerborene@users.noreply.github.com>2021-11-28 19:22:26 -0300
committerGitHub <noreply@github.com>2021-11-28 17:22:26 -0500
commit5e5af50e64a33ecd9c91aaa773d4f8428945ac74 (patch)
treeda302257117b2a2ef8b4e0b213b0ada97425dec7
parent9ee68c1bd57d72e8a969f1da492bd51bfa5ed9a0 (diff)
caddyfile: make renew_interval option configurable (#4451)
-rw-r--r--caddyconfig/httpcaddyfile/options.go1
-rw-r--r--caddyconfig/httpcaddyfile/tlsapp.go8
-rw-r--r--caddytest/integration/caddyfile_adapt/global_options_acme.txt2
3 files changed, 11 insertions, 0 deletions
diff --git a/caddyconfig/httpcaddyfile/options.go b/caddyconfig/httpcaddyfile/options.go
index f693110..91709cc 100644
--- a/caddyconfig/httpcaddyfile/options.go
+++ b/caddyconfig/httpcaddyfile/options.go
@@ -34,6 +34,7 @@ func init() {
RegisterGlobalOption("order", parseOptOrder)
RegisterGlobalOption("storage", parseOptStorage)
RegisterGlobalOption("storage_clean_interval", parseOptDuration)
+ RegisterGlobalOption("renew_interval", parseOptDuration)
RegisterGlobalOption("acme_ca", parseOptSingleString)
RegisterGlobalOption("acme_ca_root", parseOptSingleString)
RegisterGlobalOption("acme_dns", parseOptACMEDNS)
diff --git a/caddyconfig/httpcaddyfile/tlsapp.go b/caddyconfig/httpcaddyfile/tlsapp.go
index 0fe1fc5..b11addc 100644
--- a/caddyconfig/httpcaddyfile/tlsapp.go
+++ b/caddyconfig/httpcaddyfile/tlsapp.go
@@ -286,6 +286,14 @@ func (st ServerType) buildTLSApp(
tlsApp.Automation.StorageCleanInterval = storageCleanInterval
}
+ // set the expired certificates renew interval if configured
+ if renewCheckInterval, ok := options["renew_interval"].(caddy.Duration); ok {
+ if tlsApp.Automation == nil {
+ tlsApp.Automation = new(caddytls.AutomationConfig)
+ }
+ tlsApp.Automation.RenewCheckInterval = renewCheckInterval
+ }
+
// if any hostnames appear on the same server block as a key with
// no host, they will not be used with route matchers because the
// hostless key matches all hosts, therefore, it wouldn't be
diff --git a/caddytest/integration/caddyfile_adapt/global_options_acme.txt b/caddytest/integration/caddyfile_adapt/global_options_acme.txt
index 36f317a..58ade30 100644
--- a/caddytest/integration/caddyfile_adapt/global_options_acme.txt
+++ b/caddytest/integration/caddyfile_adapt/global_options_acme.txt
@@ -21,6 +21,7 @@
burst 20
}
storage_clean_interval 7d
+ renew_interval 1d
key_type ed25519
}
@@ -82,6 +83,7 @@
},
"ask": "https://example.com"
},
+ "renew_interval": 86400000000000,
"storage_clean_interval": 604800000000000
}
}