Skip to content

Commit

Permalink
Merge pull request #18742 from ahrtr/refactor_cfg_20241015
Browse files Browse the repository at this point in the history
Update `endpointsFromCluster` to reuse `clientConfigFromCmd`
  • Loading branch information
ahrtr authored Oct 16, 2024
2 parents 264d329 + b757772 commit 6779a89
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 6779a89

Please sign in to comment.