mirror of
https://github.com/coredns/coredns.git
synced 2025-10-31 18:23:13 -04:00
plugin/auto: Reload zones every one minute (#2516)
Automatically submitted.
This commit is contained in:
@@ -77,9 +77,15 @@ func setup(c *caddy.Controller) error {
|
||||
}
|
||||
|
||||
func autoParse(c *caddy.Controller) (Auto, error) {
|
||||
nilInterval := -1 * time.Second
|
||||
var a = Auto{
|
||||
loader: loader{template: "${1}", re: regexp.MustCompile(`db\.(.*)`), duration: 60 * time.Second},
|
||||
Zones: &Zones{},
|
||||
loader: loader{
|
||||
template: "${1}",
|
||||
re: regexp.MustCompile(`db\.(.*)`),
|
||||
ReloadInterval: nilInterval,
|
||||
duration: nilInterval,
|
||||
},
|
||||
Zones: &Zones{},
|
||||
}
|
||||
|
||||
config := dnsserver.GetConfig(c)
|
||||
@@ -141,6 +147,7 @@ func autoParse(c *caddy.Controller) (Auto, error) {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -169,5 +176,15 @@ func autoParse(c *caddy.Controller) (Auto, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
return a, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user