@marcel91200 / caddy Mirror · read-only / commits / bce2edd2
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

tls: Asynchronous cert management at startup (uses CertMagic v0.8.0)

Matthew Holt committed Oct 16, 2019 at 15:20 UTC bce2edd22da8c419f7f4db7bccf719046b4700c7
3 files changed +10 -2
go.mod
+1 -1
@@ -14,7 +14,7 @@ require (
14 github.com/klauspost/compress v1.8.6
15 github.com/klauspost/cpuid v1.2.1
16 github.com/lucas-clemente/quic-go v0.12.1
17 - github.com/mholt/certmagic v0.7.5
17 + github.com/mholt/certmagic v0.8.0
18 github.com/muhammadmuzzammil1998/jsonc v0.0.0-20190906142622-1265e9b150c6
19 github.com/rs/cors v1.7.0
20 github.com/russross/blackfriday/v2 v2.0.1
go.sum
+2
@@ -172,6 +172,8 @@ github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
172 github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
173 github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
174 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
175 +github.com/mholt/certmagic v0.8.0 h1:WEQhZ4+ySd2cQz0Gf1iEk6xsUaEmmHe10SZiiKd7BdY=
176 +github.com/mholt/certmagic v0.8.0/go.mod h1:91uJzK5K8IWtYQqTi5R2tsxV1pCde+wdGfaRaOZi6aQ=
177 github.com/miekg/dns v1.1.15 h1:CSSIDtllwGLMoA6zjdKnaE6Tx6eVUxQ29LUgGetiDCI=
178 github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
179 github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ=
modules/caddytls/tls.go
+7 -1
@@ -189,7 +189,12 @@ func (t *TLS) Manage(names []string) error {
189 for _, name := range names {
190 ap := t.getAutomationPolicyForName(name)
191 magic := certmagic.New(t.certCache, ap.makeCertMagicConfig(t.ctx))
192 - err := magic.Manage([]string{name})
192 + var err error
193 + if ap.ManageSync {
194 + err = magic.ManageSync([]string{name})
195 + } else {
196 + err = magic.ManageAsync(t.ctx.Context, []string{name})
197 + }
198 if err != nil {
199 return fmt.Errorf("automate: manage %s: %v", name, err)
200 }
@@ -317,6 +322,7 @@ type AutomationConfig struct {
322 type AutomationPolicy struct {
323 Hosts []string `json:"hosts,omitempty"`
324 ManagementRaw json.RawMessage `json:"management,omitempty"`
325 + ManageSync bool `json:"manage_sync,omitempty"`
326
327 Management ManagerMaker `json:"-"`
328 }