aboutsummaryrefslogtreecommitdiff
path: root/plugin/template
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/template')
-rw-r--r--plugin/template/README.md19
-rw-r--r--plugin/template/setup.go8
-rw-r--r--plugin/template/setup_test.go7
3 files changed, 10 insertions, 24 deletions
diff --git a/plugin/template/README.md b/plugin/template/README.md
index 17dedbfa9..bcb5b2dd7 100644
--- a/plugin/template/README.md
+++ b/plugin/template/README.md
@@ -12,14 +12,13 @@ The *template* plugin allows you to dynamically respond to queries by just writi
~~~
template CLASS TYPE [ZONE...] {
- [match REGEX...]
- [answer RR]
- [additional RR]
- [authority RR]
- [...]
- [rcode CODE]
- [upstream [ADDRESS...]]
- [fallthrough [ZONE...]]
+ match REGEX...
+ answer RR
+ additional RR
+ authority RR
+ rcode CODE
+ upstream
+ fallthrough [ZONE...]
}
~~~
@@ -30,9 +29,7 @@ template CLASS TYPE [ZONE...] {
* `answer|additional|authority` **RR** A [RFC 1035](https://tools.ietf.org/html/rfc1035#section-5) style resource record fragment
built by a [Go template](https://golang.org/pkg/text/template/) that contains the reply.
* `rcode` **CODE** A response code (`NXDOMAIN, SERVFAIL, ...`). The default is `SUCCESS`.
-* `upstream` [**ADDRESS**...] defines the upstream resolvers used for resolving CNAME.
- If no **ADDRESS** is given, CoreDNS will resolve CNAMEs against itself. **ADDRESS**
- can be an IP, an IP:port, or a path to a file structured like resolv.conf.
+* `upstream` defines the upstream resolvers used for resolving CNAMEs. CoreDNS will resolve CNAMEs against itself.
* `fallthrough` Continue with the next plugin if the zone matched but no regex matched.
If specific zones are listed (for example `in-addr.arpa` and `ip6.arpa`), then only queries for
those zones will be subject to fallthrough.
diff --git a/plugin/template/setup.go b/plugin/template/setup.go
index 841d2944f..9f122277a 100644
--- a/plugin/template/setup.go
+++ b/plugin/template/setup.go
@@ -144,12 +144,8 @@ func templateParse(c *caddy.Controller) (handler Handler, err error) {
t.fall.SetZonesFromArgs(c.RemainingArgs())
case "upstream":
- args := c.RemainingArgs()
- u, err := upstream.New(args)
- if err != nil {
- return handler, err
- }
- t.upstream = &u
+ c.RemainingArgs() // eat remaining args
+ t.upstream = upstream.New()
default:
return handler, c.ArgErr()
}
diff --git a/plugin/template/setup_test.go b/plugin/template/setup_test.go
index 7581bd306..64afac32a 100644
--- a/plugin/template/setup_test.go
+++ b/plugin/template/setup_test.go
@@ -148,13 +148,6 @@ func TestSetupParse(t *testing.T) {
}`,
false,
},
- {
- `template ANY ANY up.stream.local {
- answer "up.stream.local 5 IN CNAME up.river.local"
- upstream invalid-upstream-argument
- }`,
- true,
- },
}
for i, test := range tests {
c := caddy.NewTestController("dns", test.inputFileRules)