Skip to content

Commit

Permalink
etcdctl: suggest endpoint over peers flag
Browse files Browse the repository at this point in the history
  • Loading branch information
xiang90 committed Aug 27, 2015
1 parent 1124a06 commit 6a71632
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions etcdctl/command/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,19 @@ func argOrStdin(args []string, stdin io.Reader, i int) (string, error) {
}

func getPeersFlagValue(c *cli.Context) []string {
peerstr := c.GlobalString("peers")
peerstr := c.GlobalString("endpoint")

if peerstr == "" {
peerstr = os.Getenv("ETCDCTL_ENDPOINT")
}

if peerstr == "" {
fmt.Println("warning: flag peers may not work in future releases; use endpoint")
peerstr = c.GlobalString("peers")
}

// Use an environment variable if nothing was supplied on the
// command line
if peerstr == "" {
fmt.Println("warning: environment variable ETCDCTL_PEERS may not work in future releases; use ETCDCTL_ENDPOINT")
peerstr = os.Getenv("ETCDCTL_PEERS")
}

Expand Down
1 change: 1 addition & 0 deletions etcdctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func main() {
cli.StringFlag{Name: "output, o", Value: "simple", Usage: "output response in the given format (`simple`, `extended` or `json`)"},
cli.StringFlag{Name: "discovery-srv, D", Usage: "domain name to query for SRV records describing cluster endpoints"},
cli.StringFlag{Name: "peers, C", Value: "", Usage: "a comma-delimited list of machine addresses in the cluster (default: \"http://127.0.0.1:4001,http://127.0.0.1:2379\")"},
cli.StringFlag{Name: "endpoint", Value: "", Usage: "a comma-delimited list of machine addresses in the cluster (default: \"http://127.0.0.1:4001,http://127.0.0.1:2379\")"},
cli.StringFlag{Name: "cert-file", Value: "", Usage: "identify HTTPS client using this SSL certificate file"},
cli.StringFlag{Name: "key-file", Value: "", Usage: "identify HTTPS client using this SSL key file"},
cli.StringFlag{Name: "ca-file", Value: "", Usage: "verify certificates of HTTPS-enabled servers using this CA bundle"},
Expand Down

0 comments on commit 6a71632

Please sign in to comment.