Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use flagext.Secret for etcd password #136

Merged
merged 1 commit into from
Feb 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions kv/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ type Config struct {
EnableTLS bool `yaml:"tls_enabled" category:"advanced"`
TLS dstls.ClientConfig `yaml:",inline"`

UserName string `yaml:"username"`
Password string `yaml:"password"`
UserName string `yaml:"username"`
Password flagext.Secret `yaml:"password"`
}

// Clientv3Facade is a subset of all Etcd client operations that are required
Expand Down Expand Up @@ -58,7 +58,7 @@ func (cfg *Config) RegisterFlagsWithPrefix(f *flag.FlagSet, prefix string) {
f.IntVar(&cfg.MaxRetries, prefix+"etcd.max-retries", 10, "The maximum number of retries to do for failed ops.")
f.BoolVar(&cfg.EnableTLS, prefix+"etcd.tls-enabled", false, "Enable TLS.")
f.StringVar(&cfg.UserName, prefix+"etcd.username", "", "Etcd username.")
f.StringVar(&cfg.Password, prefix+"etcd.password", "", "Etcd password.")
f.Var(&cfg.Password, prefix+"etcd.password", "Etcd password.")
cfg.TLS.RegisterFlagsWithPrefix(prefix+"etcd", f)
}

Expand Down Expand Up @@ -105,7 +105,7 @@ func New(cfg Config, codec codec.Codec, logger log.Logger) (*Client, error) {
PermitWithoutStream: true,
TLS: tlsConfig,
Username: cfg.UserName,
Password: cfg.Password,
Password: cfg.Password.String(),
})
if err != nil {
return nil, err
Expand Down