From 8d8033df55b91d5ce316aa40c99598d56d2188df Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Thu, 27 Aug 2015 15:42:44 -0700 Subject: [PATCH] etcdctl: suggest endpoint over peers flag --- etcdctl/command/util.go | 12 +++++++++--- etcdctl/main.go | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/etcdctl/command/util.go b/etcdctl/command/util.go index a3f70d065..31b2f8b7d 100644 --- a/etcdctl/command/util.go +++ b/etcdctl/command/util.go @@ -59,10 +59,16 @@ 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 == "" { + peerstr = c.GlobalString("peers") + } - // Use an environment variable if nothing was supplied on the - // command line if peerstr == "" { peerstr = os.Getenv("ETCDCTL_PEERS") } diff --git a/etcdctl/main.go b/etcdctl/main.go index 8c8703593..da30af69c 100644 --- a/etcdctl/main.go +++ b/etcdctl/main.go @@ -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"},