Skip to content

Commit

Permalink
Update endpointsFromCluster to reuse clientConfigFromCmd
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
  • Loading branch information
ahrtr committed Oct 15, 2024
1 parent 54db7f0 commit b757772
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions etcdctl/ctlv3/command/ep_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,23 +251,10 @@ func endpointsFromCluster(cmd *cobra.Command) []string {
return endpoints
}

sec := secureCfgFromCmd(cmd)
dt := dialTimeoutFromCmd(cmd)
ka := keepAliveTimeFromCmd(cmd)
kat := keepAliveTimeoutFromCmd(cmd)
eps, err := endpointsFromCmd(cmd)
if err != nil {
cobrautl.ExitWithError(cobrautl.ExitError, err)
}
cfgSpec := clientConfigFromCmd(cmd)
// exclude auth for not asking needless password (MemberList() doesn't need authentication)
lg, _ := logutil.CreateDefaultZapLogger(zap.InfoLevel)
cfg, err := clientv3.NewClientConfig(&clientv3.ConfigSpec{
Endpoints: eps,
DialTimeout: dt,
KeepAliveTime: ka,
KeepAliveTimeout: kat,
Secure: sec,
}, lg)
cfg, err := clientv3.NewClientConfig(cfgSpec, lg)
if err != nil {
cobrautl.ExitWithError(cobrautl.ExitError, err)
}
Expand Down

0 comments on commit b757772

Please sign in to comment.