diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2021-01-05 14:39:30 -0700 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2021-01-05 14:39:30 -0700 |
commit | f0216967dca12831b1aac351fc8c4bfcea148697 (patch) | |
tree | 7e444eec3fd296dd45d27a3e36897b37d2ae1b6d /modules/caddytls | |
parent | b1bec8c8992424b423db3d92101bd5b4989dcf65 (diff) |
caddyfile: Refactor unmarshaling of module tokens
Eliminates a fair amount of repeated code
Diffstat (limited to 'modules/caddytls')
-rw-r--r-- | modules/caddytls/acmeissuer.go | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/modules/caddytls/acmeissuer.go b/modules/caddytls/acmeissuer.go index df071c4..43e758f 100644 --- a/modules/caddytls/acmeissuer.go +++ b/modules/caddytls/acmeissuer.go @@ -354,18 +354,11 @@ func (iss *ACMEIssuer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { if iss.Challenges.DNS == nil { iss.Challenges.DNS = new(DNSChallengeConfig) } - dnsProvModule, err := caddy.GetModule("dns.providers." + provName) + unm, err := caddyfile.UnmarshalModule(d, "dns.providers."+provName) if err != nil { - return d.Errf("getting DNS provider module named '%s': %v", provName, err) + return err } - dnsProvModuleInstance := dnsProvModule.New() - if unm, ok := dnsProvModuleInstance.(caddyfile.Unmarshaler); ok { - err = unm.UnmarshalCaddyfile(d.NewFromNextSegment()) - if err != nil { - return err - } - } - iss.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(dnsProvModuleInstance, "name", provName, nil) + iss.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(unm, "name", provName, nil) case "resolvers": if iss.Challenges == nil { |