mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
all: simply registering plugins (#3287)
Abstract the caddy call and make it simpler. See #3261 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>
This commit is contained in:
11
plugin/register.go
Normal file
11
plugin/register.go
Normal file
@@ -0,0 +1,11 @@
|
||||
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,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user