@marcel91200 / caddy Mirror · read-only / commits / ea3688e1
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, 05:15 UTC

caddytls: Remove ManageSync

This seems unnecessary for now and we can always add it in later if people have a good reason to need it.

Matthew Holt committed Mar 26, 2020 at 14:02 UTC ea3688e1c057a042bbae97175f42eb4ec3029667
3 files changed +5 -20
caddyconfig/httpcaddyfile/tlsapp.go
+1 -2
@@ -361,8 +361,7 @@ func consolidateAutomationPolicies(aps []*caddytls.AutomationPolicy) []*caddytls
361 aps[i].MustStaple == aps[j].MustStaple &&
362 aps[i].KeyType == aps[j].KeyType &&
363 aps[i].OnDemand == aps[j].OnDemand &&
364 - aps[i].RenewalWindowRatio == aps[j].RenewalWindowRatio &&
365 - aps[i].ManageSync == aps[j].ManageSync {
364 + aps[i].RenewalWindowRatio == aps[j].RenewalWindowRatio {
365 if len(aps[i].Subjects) == 0 && len(aps[j].Subjects) > 0 {
366 aps = append(aps[:j], aps[j+1:]...)
367 } else if len(aps[i].Subjects) > 0 && len(aps[j].Subjects) == 0 {
modules/caddytls/automation.go
-9
@@ -97,15 +97,6 @@ type AutomationPolicy struct {
97 // load.
98 OnDemand bool `json:"on_demand,omitempty"`
99
100 - // If true, certificate management will be conducted
101 - // in the foreground; this will block config reloads
102 - // and return errors if there were problems with
103 - // obtaining or renewing certificates. This is often
104 - // not desirable, especially when serving sites out
105 - // of your control. Default: false
106 - // TODO: is this really necessary per-policy? why not a global setting...
107 - ManageSync bool `json:"manage_sync,omitempty"`
108 -
100 // Issuer stores the decoded issuer parameters. This is only
101 // used to populate an underlying certmagic.Config's Issuer
102 // field; it is not referenced thereafter.
modules/caddytls/tls.go
+4 -9
@@ -247,8 +247,8 @@ func (t *TLS) Cleanup() error {
247 func (t *TLS) Manage(names []string) error {
248 // for a large number of names, we can be more memory-efficient
249 // by making only one certmagic.Config for all the names that
250 - // use that config, rather than calling ManageSync/ManageAsync
251 - // once for every name; so first, bin names by AutomationPolicy
250 + // use that config, rather than calling ManageAsync once for
251 + // every name; so first, bin names by AutomationPolicy
252 policyToNames := make(map[*AutomationPolicy][]string)
253 for _, name := range names {
254 ap := t.getAutomationPolicyForName(name)
@@ -257,14 +257,9 @@ func (t *TLS) Manage(names []string) error {
257
258 // now that names are grouped by policy, we can simply make one
259 // certmagic.Config for each (potentially large) group of names
260 - // and call ManageSync/ManageAsync just once for the whole batch
260 + // and call ManageAsync just once for the whole batch
261 for ap, names := range policyToNames {
262 - var err error
263 - if ap.ManageSync {
264 - err = ap.magic.ManageSync(names)
265 - } else {
266 - err = ap.magic.ManageAsync(t.ctx.Context, names)
267 - }
262 + err := ap.magic.ManageAsync(t.ctx.Context, names)
263 if err != nil {
264 return fmt.Errorf("automate: manage %v: %v", names, err)
265 }