coredns/plugin/register.go
Miek Gieben 004c5fca9d
all: simply registering plugins ()
Abstract the caddy call and make it simpler.

See  for some part of the discussion.

Go from:

~~~ go
func init() {
       caddy.RegisterPlugin("any", caddy.Plugin{
               ServerType: "dns",
               Action:     setup,
       })
}
~~~

To:

~~~ go
func init() { plugin.Register("any", setup) }
~~~

This requires some external documents in coredns.io to be updated as
well; the old way still works, so it's backwards compatible.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-20 08:02:30 +01:00

11 lines
301 B
Go

package plugin
import "github.com/caddyserver/caddy"
// Register registers your plugin with CoreDNS and allows it to be called when the server is running.
func Register(name string, action caddy.SetupFunc) {
caddy.RegisterPlugin(name, caddy.Plugin{
ServerType: "dns",
Action: action,
})
}