plugins: calling Dispenser itself is a mistake (#3323)

Remove all these uses and just make them work on caddy.Controller. Also
don't export parsing functions as their should be private to the plugin.

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben 2019-09-28 10:41:12 +01:00 committed by GitHub
parent ba5d4a6372
commit 03a3695ea9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 13 deletions

View file

@ -11,7 +11,6 @@ import (
pkgtls "github.com/coredns/coredns/plugin/pkg/tls"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyfile"
)
func init() { plugin.Register("grpc", setup) }
@ -50,7 +49,7 @@ func parseGRPC(c *caddy.Controller) (*GRPC, error) {
return nil, plugin.ErrOnce
}
i++
g, err = parseGRPCStanza(&c.Dispenser)
g, err = parseStanza(c)
if err != nil {
return nil, err
}
@ -58,7 +57,7 @@ func parseGRPC(c *caddy.Controller) (*GRPC, error) {
return g, nil
}
func parseGRPCStanza(c *caddyfile.Dispenser) (*GRPC, error) {
func parseStanza(c *caddy.Controller) (*GRPC, error) {
g := newGRPC()
if !c.Args(&g.from) {
@ -99,7 +98,7 @@ func parseGRPCStanza(c *caddyfile.Dispenser) (*GRPC, error) {
return g, nil
}
func parseBlock(c *caddyfile.Dispenser, g *GRPC) error {
func parseBlock(c *caddy.Controller, g *GRPC) error {
switch c.Val() {
case "except":