aboutsummaryrefslogtreecommitdiff
path: root/plugin/loadbalance/setup.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/loadbalance/setup.go')
-rw-r--r--plugin/loadbalance/setup.go24
1 files changed, 22 insertions, 2 deletions
diff --git a/plugin/loadbalance/setup.go b/plugin/loadbalance/setup.go
index 38dce6308..9d52a3cbe 100644
--- a/plugin/loadbalance/setup.go
+++ b/plugin/loadbalance/setup.go
@@ -1,6 +1,8 @@
package loadbalance
import (
+ "fmt"
+
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/plugin"
clog "github.com/coredns/coredns/plugin/pkg/log"
@@ -18,8 +20,9 @@ func init() {
}
func setup(c *caddy.Controller) error {
- for c.Next() {
- // TODO(miek): block and option parsing
+ err := parse(c)
+ if err != nil {
+ return plugin.Error("loadbalance", err)
}
dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler {
@@ -28,3 +31,20 @@ func setup(c *caddy.Controller) error {
return nil
}
+
+func parse(c *caddy.Controller) error {
+ for c.Next() {
+ args := c.RemainingArgs()
+ switch len(args) {
+ case 0:
+ return nil
+ case 1:
+ if args[0] != "round_robin" {
+ return fmt.Errorf("unknown policy: %s", args[0])
+
+ }
+ return nil
+ }
+ }
+ return c.ArgErr()
+}