mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 18:53:43 -04:00
Remove the word middleware (#1067)
* Rename middleware to plugin first pass; mostly used 'sed', few spots where I manually changed text. This still builds a coredns binary. * fmt error * Rename AddMiddleware to AddPlugin * Readd AddMiddleware to remain backwards compat
This commit is contained in:
28
plugin/whoami/setup.go
Normal file
28
plugin/whoami/setup.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package whoami
|
||||
|
||||
import (
|
||||
"github.com/coredns/coredns/core/dnsserver"
|
||||
"github.com/coredns/coredns/plugin"
|
||||
|
||||
"github.com/mholt/caddy"
|
||||
)
|
||||
|
||||
func init() {
|
||||
caddy.RegisterPlugin("whoami", caddy.Plugin{
|
||||
ServerType: "dns",
|
||||
Action: setupWhoami,
|
||||
})
|
||||
}
|
||||
|
||||
func setupWhoami(c *caddy.Controller) error {
|
||||
c.Next() // 'whoami'
|
||||
if c.NextArg() {
|
||||
return plugin.Error("whoami", c.ArgErr())
|
||||
}
|
||||
|
||||
dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler {
|
||||
return Whoami{}
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user