diff --git a/prog/weaver/main.go b/prog/weaver/main.go index 2be9e1ac..2e736b87 100644 --- a/prog/weaver/main.go +++ b/prog/weaver/main.go @@ -53,7 +53,7 @@ type dnsConfig struct { func (c *ipamConfig) Enabled() bool { var ( hasPeerCount = c.PeerCount > 0 - hasMode = len(c.Mode) > 0 + hasMode = c.HasMode() hasRange = c.IPRangeCIDR != "" hasSubnet = c.IPSubnetCIDR != "" ) @@ -75,6 +75,10 @@ func (c *ipamConfig) Enabled() bool { return true } +func (c ipamConfig) HasMode() bool { + return len(c.Mode) > 0 +} + func (c *ipamConfig) parseMode() error { modeAndParam := strings.SplitN(c.Mode, "=", 2)