aboutsummaryrefslogtreecommitdiff
path: root/plugin/auto/setup.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/auto/setup.go')
-rw-r--r--plugin/auto/setup.go33
1 files changed, 8 insertions, 25 deletions
diff --git a/plugin/auto/setup.go b/plugin/auto/setup.go
index 733b2f44a..2e2d0a37d 100644
--- a/plugin/auto/setup.go
+++ b/plugin/auto/setup.go
@@ -4,7 +4,6 @@ import (
"os"
"path/filepath"
"regexp"
- "strconv"
"time"
"github.com/coredns/coredns/core/dnsserver"
@@ -50,7 +49,7 @@ func setup(c *caddy.Controller) error {
}
go func() {
- ticker := time.NewTicker(a.loader.duration)
+ ticker := time.NewTicker(a.loader.ReloadInterval)
for {
select {
case <-walkChan:
@@ -83,7 +82,6 @@ func autoParse(c *caddy.Controller) (Auto, error) {
template: "${1}",
re: regexp.MustCompile(`db\.(.*)`),
ReloadInterval: nilInterval,
- duration: nilInterval,
},
Zones: &Zones{},
}
@@ -105,7 +103,7 @@ func autoParse(c *caddy.Controller) (Auto, error) {
for c.NextBlock() {
switch c.Val() {
- case "directory": // directory DIR [REGEXP [TEMPLATE] [DURATION]]
+ case "directory": // directory DIR [REGEXP TEMPLATE]
if !c.NextArg() {
return a, c.ArgErr()
}
@@ -138,17 +136,8 @@ func autoParse(c *caddy.Controller) (Auto, error) {
a.loader.template = rewriteToExpand(c.Val())
}
- // duration
if c.NextArg() {
- i, err := strconv.Atoi(c.Val())
- if err != nil {
- return a, err
- }
- if i < 1 {
- i = 1
- }
- log.Warning("TIMEOUT of directory is deprecated. Use RELOAD instead. See https://coredns.io/plugins/auto/#syntax")
- a.loader.duration = time.Duration(i) * time.Second
+ return Auto{}, c.ArgErr()
}
case "reload":
@@ -158,15 +147,11 @@ func autoParse(c *caddy.Controller) (Auto, error) {
}
a.loader.ReloadInterval = d
- case "no_reload":
- log.Warning("NO_RELOAD of directory is deprecated. Use RELOAD (set to 0) instead. See https://coredns.io/plugins/auto/#syntax")
- a.loader.ReloadInterval = 0
-
case "upstream":
c.RemainingArgs() // eat remaining args
a.loader.upstream = upstream.New()
- default:
+ case "transfer":
t, _, e := parse.Transfer(c, false)
if e != nil {
return a, e
@@ -174,17 +159,15 @@ func autoParse(c *caddy.Controller) (Auto, error) {
if t != nil {
a.loader.transferTo = append(a.loader.transferTo, t...)
}
+
+ default:
+ return Auto{}, c.Errf("unknown property '%s'", c.Val())
}
}
}
if a.loader.ReloadInterval == nilInterval {
- if a.loader.duration == nilInterval {
- a.loader.duration = 60 * time.Second
- }
- a.loader.ReloadInterval = a.loader.duration
- } else if a.loader.duration == nilInterval {
- a.loader.duration = a.loader.ReloadInterval
+ a.loader.ReloadInterval = 60 * time.Second
}
return a, nil