mirror of
https://github.com/coredns/coredns.git
synced 2025-11-03 02:33:21 -05:00
middleware/etcd: remove double switch in setup.go (#768)
This commit is contained in:
@@ -74,7 +74,7 @@ func etcdParse(c *caddy.Controller) (*Etcd, bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if c.NextBlock() {
|
if c.NextBlock() {
|
||||||
// TODO(miek): 2 switches?
|
for {
|
||||||
switch c.Val() {
|
switch c.Val() {
|
||||||
case "stubzones":
|
case "stubzones":
|
||||||
stubzones = true
|
stubzones = true
|
||||||
@@ -112,43 +112,9 @@ func etcdParse(c *caddy.Controller) (*Etcd, bool, error) {
|
|||||||
return &Etcd{}, false, c.Errf("unknown property '%s'", c.Val())
|
return &Etcd{}, false, c.Errf("unknown property '%s'", c.Val())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for c.Next() {
|
|
||||||
switch c.Val() {
|
if !c.Next() {
|
||||||
case "stubzones":
|
break
|
||||||
stubzones = true
|
|
||||||
case "debug":
|
|
||||||
etc.Debugging = true
|
|
||||||
case "path":
|
|
||||||
if !c.NextArg() {
|
|
||||||
return &Etcd{}, false, c.ArgErr()
|
|
||||||
}
|
|
||||||
etc.PathPrefix = c.Val()
|
|
||||||
case "endpoint":
|
|
||||||
args := c.RemainingArgs()
|
|
||||||
if len(args) == 0 {
|
|
||||||
return &Etcd{}, false, c.ArgErr()
|
|
||||||
}
|
|
||||||
endpoints = args
|
|
||||||
case "upstream":
|
|
||||||
args := c.RemainingArgs()
|
|
||||||
if len(args) == 0 {
|
|
||||||
return &Etcd{}, false, c.ArgErr()
|
|
||||||
}
|
|
||||||
ups, err := dnsutil.ParseHostPortOrFile(args...)
|
|
||||||
if err != nil {
|
|
||||||
return &Etcd{}, false, c.ArgErr()
|
|
||||||
}
|
|
||||||
etc.Proxy = proxy.NewLookup(ups)
|
|
||||||
case "tls": // cert key cacertfile
|
|
||||||
args := c.RemainingArgs()
|
|
||||||
tlsConfig, err = mwtls.NewTLSConfigFromArgs(args...)
|
|
||||||
if err != nil {
|
|
||||||
return &Etcd{}, false, err
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
if c.Val() != "}" { // TODO(miek): this feels like I'm doing it completely wrong.
|
|
||||||
return &Etcd{}, false, c.Errf("unknown property '%s'", c.Val())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user