summaryrefslogtreecommitdiff
path: root/modules/caddytls
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-10-16 15:20:27 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-10-16 15:20:27 -0600
commitbce2edd22da8c419f7f4db7bccf719046b4700c7 (patch)
treee7db6c5c752484a2db8370cde75f0545c4d900d4 /modules/caddytls
parenta458544d9f6e6aaf72aeab0454acfa482880d3d6 (diff)
tls: Asynchronous cert management at startup (uses CertMagic v0.8.0)
Diffstat (limited to 'modules/caddytls')
-rw-r--r--modules/caddytls/tls.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/caddytls/tls.go b/modules/caddytls/tls.go
index cb27a9e..7aa1856 100644
--- a/modules/caddytls/tls.go
+++ b/modules/caddytls/tls.go
@@ -189,7 +189,12 @@ func (t *TLS) Manage(names []string) error {
for _, name := range names {
ap := t.getAutomationPolicyForName(name)
magic := certmagic.New(t.certCache, ap.makeCertMagicConfig(t.ctx))
- err := magic.Manage([]string{name})
+ var err error
+ if ap.ManageSync {
+ err = magic.ManageSync([]string{name})
+ } else {
+ err = magic.ManageAsync(t.ctx.Context, []string{name})
+ }
if err != nil {
return fmt.Errorf("automate: manage %s: %v", name, err)
}
@@ -317,6 +322,7 @@ type AutomationConfig struct {
type AutomationPolicy struct {
Hosts []string `json:"hosts,omitempty"`
ManagementRaw json.RawMessage `json:"management,omitempty"`
+ ManageSync bool `json:"manage_sync,omitempty"`
Management ManagerMaker `json:"-"`
}