diff options
author | 2018-09-29 17:50:49 +0200 | |
---|---|---|
committer | 2018-09-29 16:50:49 +0100 | |
commit | 552aab723c05088d049f085ee3b480dac1dbdba7 (patch) | |
tree | cd6ecf70b028a1b4412728b967be9d1abd26678c /plugin/file/setup.go | |
parent | a80ec6096f71337600ff2694040be1efb7b6b87b (diff) | |
download | coredns-552aab723c05088d049f085ee3b480dac1dbdba7.tar.gz coredns-552aab723c05088d049f085ee3b480dac1dbdba7.tar.zst coredns-552aab723c05088d049f085ee3b480dac1dbdba7.zip |
Configurable zone reload interval in file plugin (#2110)
* Configurable zone reload interval in file plugin
* passing reload config from auto plugin to file plugin. removed noReload property from Zone struct. fixed tests based on short file reload hack
Diffstat (limited to 'plugin/file/setup.go')
-rw-r--r-- | plugin/file/setup.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/plugin/file/setup.go b/plugin/file/setup.go index 457ea5348..86eef6b96 100644 --- a/plugin/file/setup.go +++ b/plugin/file/setup.go @@ -3,6 +3,7 @@ package file import ( "os" "path" + "time" "github.com/coredns/coredns/core/dnsserver" "github.com/coredns/coredns/plugin" @@ -91,7 +92,7 @@ func fileParse(c *caddy.Controller) (Zones, error) { names = append(names, origins[i]) } - noReload := false + reload := 1 * time.Minute upstr := upstream.Upstream{} t := []string{} var e error @@ -104,8 +105,15 @@ func fileParse(c *caddy.Controller) (Zones, error) { return Zones{}, e } + case "reload": + d, err := time.ParseDuration(c.RemainingArgs()[0]) + if err != nil { + return Zones{}, plugin.Error("file", err) + } + reload = d + case "no_reload": - noReload = true + reload = 0 case "upstream": args := c.RemainingArgs() @@ -122,7 +130,7 @@ func fileParse(c *caddy.Controller) (Zones, error) { if t != nil { z[origin].TransferTo = append(z[origin].TransferTo, t...) } - z[origin].NoReload = noReload + z[origin].ReloadInterval = reload z[origin].Upstream = upstr } } |