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:
Miek Gieben 2019-09-20 08:02:30 +01:00 committed by GitHub
parent 85e65702bd
commit 004c5fca9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 54 additions and 220 deletions

View file

@ -34,12 +34,7 @@ import (
var log = clog.NewWithPlugin("kubernetes")
func init() {
caddy.RegisterPlugin("kubernetes", caddy.Plugin{
ServerType: "dns",
Action: setup,
})
}
func init() { plugin.Register("kubernetes", setup) }
func setup(c *caddy.Controller) error {
klog.SetOutput(os.Stdout)