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

httpcaddyfile: Add resolvers subdir of tls (close #4008)

Allows conveniently setting the resolvers for the DNS challenge using a TLS subdirective, which applies to default issuers, rather than having to explicitly define the issuers and overwrite the defaults.

Matthew Holt committed Feb 2, 2021 at 23:07 UTC 8c291298c9241cd2d130f273b25f806687ce5e87
1 file changed +18
caddyconfig/httpcaddyfile/builtins.go
+18
@@ -316,6 +316,8 @@ func parseTLS(h Helper) ([]ConfigValue, error) {
316 }
317 if acmeIssuer.Challenges == nil {
318 acmeIssuer.Challenges = new(caddytls.ChallengesConfig)
319 + }
320 + if acmeIssuer.Challenges.DNS == nil {
321 acmeIssuer.Challenges.DNS = new(caddytls.DNSChallengeConfig)
322 }
323 modID := "dns.providers." + provName
@@ -325,6 +327,22 @@ func parseTLS(h Helper) ([]ConfigValue, error) {
327 }
328 acmeIssuer.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(unm, "name", provName, h.warnings)
329
330 + case "resolvers":
331 + args := h.RemainingArgs()
332 + if len(args) == 0 {
333 + return nil, h.ArgErr()
334 + }
335 + if acmeIssuer == nil {
336 + acmeIssuer = new(caddytls.ACMEIssuer)
337 + }
338 + if acmeIssuer.Challenges == nil {
339 + acmeIssuer.Challenges = new(caddytls.ChallengesConfig)
340 + }
341 + if acmeIssuer.Challenges.DNS == nil {
342 + acmeIssuer.Challenges.DNS = new(caddytls.DNSChallengeConfig)
343 + }
344 + acmeIssuer.Challenges.DNS.Resolvers = args
345 +
346 case "ca_root":
347 arg := h.RemainingArgs()
348 if len(arg) != 1 {