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 <[email protected]>
  • Loading branch information
ahrtr authored and a-nych committed Oct 16, 2024
1 parent 9bef68c commit 983a114
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 983a114

Please sign in to comment.