r/o

cmd/enbi: don't require -node-repel. f0105f1c parent ad50e7e9

authored by ~talya

authored by Asherah Connor <ashe@kivikakk.ee> 6 months ago
committed by Asherah Connor <ashe@kivikakk.ee> 6 months ago

cmd/enbi: don't require -node-repel.

cmd/enbi/main.go | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/cmd/enbi/main.go b/cmd/enbi/main.go
index 0ef9420..a0e9be6 100644
--- a/cmd/enbi/main.go
+++ b/cmd/enbi/main.go
@@ -101,12 +101,14 @@ func main() {
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
nodeRepels := []controller.NodeRepel{}
- for _, kv := range strings.Split(nodeRepel, ",") {
- k_v := strings.SplitN(kv, "=", 2)
- if len(k_v) != 2 {
- panic("bad node-repel; no `=`?")
+ if nodeRepel != "" {
+ for _, kv := range strings.Split(nodeRepel, ",") {
+ k_v := strings.SplitN(kv, "=", 2)
+ if len(k_v) != 2 {
+ panic("bad node-repel; no `=`?")
+ }
+ nodeRepels = append(nodeRepels, controller.NodeRepel{Label: k_v[0], Value: k_v[1]})
}
- nodeRepels = append(nodeRepels, controller.NodeRepel{Label: k_v[0], Value: k_v[1]})
}
// if the enable-http2 flag is false (the default), http/2 should be disabled