From a77bd1d8877fbbc8828e464a8c600e5a8aeb9aee Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 1 May 2020 10:41:08 -0600 Subject: httpcaddyfile: Update tls parsing for DNS providers --- caddyconfig/httpcaddyfile/builtins.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/caddyconfig/httpcaddyfile/builtins.go b/caddyconfig/httpcaddyfile/builtins.go index 8137ce2..b5a9341 100644 --- a/caddyconfig/httpcaddyfile/builtins.go +++ b/caddyconfig/httpcaddyfile/builtins.go @@ -205,19 +205,26 @@ func parseTLS(h Helper) ([]ConfigValue, error) { if !h.Next() { return nil, h.ArgErr() } + provName := h.Val() if acmeIssuer == nil { acmeIssuer = new(caddytls.ACMEIssuer) } - provName := h.Val() if acmeIssuer.Challenges == nil { acmeIssuer.Challenges = new(caddytls.ChallengesConfig) acmeIssuer.Challenges.DNS = new(caddytls.DNSChallengeConfig) } - dnsProvModule, err := caddy.GetModule("tls.dns." + provName) + dnsProvModule, err := caddy.GetModule("dns.providers." + provName) if err != nil { return nil, h.Errf("getting DNS provider module named '%s': %v", provName, err) } - acmeIssuer.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(dnsProvModule.New(), "name", provName, h.warnings) + dnsProvModuleInstance := dnsProvModule.New() + if unm, ok := dnsProvModuleInstance.(caddyfile.Unmarshaler); ok { + err = unm.UnmarshalCaddyfile(h.NewFromNextSegment()) + if err != nil { + return nil, err + } + } + acmeIssuer.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(dnsProvModuleInstance, "name", provName, h.warnings) case "ca_root": arg := h.RemainingArgs() -- cgit v1.2.3