Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request etcd-io#1248 from jonboulle/disco
Browse files Browse the repository at this point in the history
main: fix temporary discovery cluster
  • Loading branch information
philips committed Oct 6, 2014
2 parents d98fe2c + 5098cb0 commit b9c8ac7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
}

0 comments on commit b9c8ac7

Please sign in to comment.