summaryrefslogtreecommitdiff
path: root/caddyconfig/httpcaddyfile/builtins.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-02-08 16:52:54 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2020-02-08 18:43:35 -0700
commit17d938fc54b347d54a4f56c1f0d6e92c65033548 (patch)
treeaa056d82b7f106858883494ed0d72fc861d54f51 /caddyconfig/httpcaddyfile/builtins.go
parent98bbc54fdcd05a2f53c10e81be7cf94d1dc62522 (diff)
httpcaddyfile: Add support for DNS challenge solvers
Configuration via the Caddyfile requires use of env variables, but an upstream issue is currently blocking that: https://github.com/go-acme/lego/issues/1054 Providers will need to be retrofitted upstream in order to support env var configuration.
Diffstat (limited to 'caddyconfig/httpcaddyfile/builtins.go')
-rw-r--r--caddyconfig/httpcaddyfile/builtins.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/caddyconfig/httpcaddyfile/builtins.go b/caddyconfig/httpcaddyfile/builtins.go
index 7c56b04..29ca0be 100644
--- a/caddyconfig/httpcaddyfile/builtins.go
+++ b/caddyconfig/httpcaddyfile/builtins.go
@@ -98,6 +98,7 @@ func parseRoot(h Helper) ([]ConfigValue, error) {
// alpn <values...>
// load <paths...>
// ca <acme_ca_endpoint>
+// dns <provider_name>
// }
//
func parseTLS(h Helper) ([]ConfigValue, error) {
@@ -217,6 +218,21 @@ func parseTLS(h Helper) ([]ConfigValue, error) {
}
mgr.CA = arg[0]
+ // DNS provider for ACME DNS challenge
+ case "dns":
+ if !h.Next() {
+ return nil, h.ArgErr()
+ }
+ provName := h.Val()
+ if mgr.Challenges == nil {
+ mgr.Challenges = new(caddytls.ChallengesConfig)
+ }
+ dnsProvModule, err := caddy.GetModule("tls.dns." + provName)
+ if err != nil {
+ return nil, h.Errf("getting DNS provider module named '%s': %v", provName, err)
+ }
+ mgr.Challenges.DNSRaw = caddyconfig.JSONModuleObject(dnsProvModule.New(), "provider", provName, h.warnings)
+
default:
return nil, h.Errf("unknown subdirective: %s", h.Val())
}