main: fix temporary discovery cluster

This commit is contained in:
Jonathan Boulle 2014-10-06 16:10:29 -07:00
parent d98fe2ce1a
commit 5098cb0d32

11
main.go
View File

@ -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
}