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:
parent
85e65702bd
commit
004c5fca9d
38 changed files with 54 additions and 220 deletions
|
@ -25,9 +25,8 @@ import (
|
|||
var log = clog.NewWithPlugin("route53")
|
||||
|
||||
func init() {
|
||||
caddy.RegisterPlugin("route53", caddy.Plugin{
|
||||
ServerType: "dns",
|
||||
Action: func(c *caddy.Controller) error {
|
||||
plugin.Register("route53",
|
||||
func(c *caddy.Controller) error {
|
||||
f := func(credential *credentials.Credentials) route53iface.Route53API {
|
||||
return route53.New(session.Must(session.NewSession(&aws.Config{
|
||||
Credentials: credential,
|
||||
|
@ -35,7 +34,7 @@ func init() {
|
|||
}
|
||||
return setup(c, f)
|
||||
},
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
func setup(c *caddy.Controller, f func(*credentials.Credentials) route53iface.Route53API) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue