diff options
author | 2019-07-18 14:56:59 +0000 | |
---|---|---|
committer | 2019-07-18 14:56:59 +0000 | |
commit | 6c9a5997610c66de7795276dd285926e6a8252af (patch) | |
tree | 1b0550fe7cbea7af84571d563264c304d20ec18f /plugin/file/setup.go | |
parent | eefe49dd3e4c804560a365e55665138ef474f4e1 (diff) | |
download | coredns-6c9a5997610c66de7795276dd285926e6a8252af.tar.gz coredns-6c9a5997610c66de7795276dd285926e6a8252af.tar.zst coredns-6c9a5997610c66de7795276dd285926e6a8252af.zip |
plugin/file: fix setting ReloadInterval (#3017)
* plugin/file: fix setting ReloadInterval
The reload interval was only correctly set if there was an extra
block for the file. Move this down to set up.
Add test case that fails before, but now works.
Signed-off-by: Miek Gieben <miek@miek.nl>
* layout and use Errorf
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/file/setup.go')
-rw-r--r-- | plugin/file/setup.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugin/file/setup.go b/plugin/file/setup.go index 9be09fe8d..162db6d65 100644 --- a/plugin/file/setup.go +++ b/plugin/file/setup.go @@ -97,7 +97,6 @@ func fileParse(c *caddy.Controller) (Zones, error) { names = append(names, origins[i]) } - upstr := upstream.New() t := []string{} var e error @@ -128,11 +127,15 @@ func fileParse(c *caddy.Controller) (Zones, error) { if t != nil { z[origin].TransferTo = append(z[origin].TransferTo, t...) } - z[origin].ReloadInterval = reload - z[origin].Upstream = upstr } } } + + for origin := range z { + z[origin].ReloadInterval = reload + z[origin].Upstream = upstream.New() + } + if openErr != nil { if reload == 0 { // reload hasn't been set make this a fatal error |