diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2019-10-16 15:20:27 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2019-10-16 15:20:27 -0600 |
commit | bce2edd22da8c419f7f4db7bccf719046b4700c7 (patch) | |
tree | e7db6c5c752484a2db8370cde75f0545c4d900d4 /modules | |
parent | a458544d9f6e6aaf72aeab0454acfa482880d3d6 (diff) |
tls: Asynchronous cert management at startup (uses CertMagic v0.8.0)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/caddytls/tls.go | 8 |
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:"-"` } |