mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 02:03:13 -05:00
core: replace GetMiddleware (#885)
* core: replace GetMiddleware See the discussion in #881. GetMiddleware would add a `nil` middleware to the callstack thereby breaking functionality. This PR drops it in favor of RegisterHandler which is a completely standalone registry for middleware that want to let it self know to other middleware. Currenly *autopath* uses this to call *kubernetes*'s AutoPath method for dynamic autopathing. * Drop GetMiddleware * Register metrics * drop the panic
This commit is contained in:
@@ -32,7 +32,9 @@ func setup(c *caddy.Controller) error {
|
||||
}
|
||||
|
||||
// If we have enabled prometheus we should add newly discovered zones to it.
|
||||
met := dnsserver.GetMiddleware(c, "prometheus")
|
||||
// This does not have to happen in a on.Startup because monitoring is one of the first
|
||||
// to be initialized.
|
||||
met := dnsserver.GetConfig(c).GetHandler("prometheus")
|
||||
if met != nil {
|
||||
a.metrics = met.(*metrics.Metrics)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user