From 5098cb0d3256dcb9e5cd348dee4717f45a847f16 Mon Sep 17 00:00:00 2001 From: Jonathan Boulle Date: Mon, 6 Oct 2014 16:10:29 -0700 Subject: [PATCH] main: fix temporary discovery cluster --- main.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 24a82b833..99bf4a242 100644 --- a/main.go +++ b/main.go @@ -60,7 +60,10 @@ var ( func init() { flag.Var(cluster, "initial-cluster", "Initial cluster configuration for bootstrapping") flag.Var(clusterState, "initial-cluster-state", "Initial cluster configuration for bootstrapping") - cluster.Set("default=http://localhost:2380,default=http://localhost:7001") + if err := cluster.Set("default=http://localhost:2380,default=http://localhost:7001"); err != nil { + // Should never happen + log.Panic(err) + } flag.Var(flagtypes.NewURLsValue("http://localhost:2380,http://localhost:7001"), "advertise-peer-urls", "List of this member's peer URLs to advertise to the rest of the cluster") flag.Var(flagtypes.NewURLsValue("http://localhost:2379,http://localhost:4001"), "advertise-client-urls", "List of this member's client URLs to advertise to the rest of the cluster") @@ -261,9 +264,11 @@ func setClusterForDiscovery() error { } addrs := make([]string, len(apurls)) for i := range apurls { - addrs[i] = apurls[i].String() + addrs[i] = fmt.Sprintf("%s=%s", *name, apurls[i].String()) + } + if err := cluster.Set(strings.Join(addrs, ",")); err != nil { + return err } - cluster.Set(fmt.Sprintf("%s=%s", *name, strings.Join(addrs, ","))) } return nil }