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:
parent
10681c6bf0
commit
ea77f2a2ca
7 changed files with 53 additions and 28 deletions
|
@ -20,7 +20,7 @@ func setup(c *caddy.Controller) error {
|
|||
return middleware.Error("proxy", err)
|
||||
}
|
||||
|
||||
t := dnsserver.GetMiddleware(c, "trace")
|
||||
t := dnsserver.GetConfig(c).GetHandler("trace")
|
||||
P := &Proxy{Trace: t}
|
||||
dnsserver.GetConfig(c).AddMiddleware(func(next middleware.Handler) middleware.Handler {
|
||||
P.Next = next
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue