Skip to content

Commit

Permalink
Use flagext.Secret for etcd password (#136)
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Pracucci <[email protected]>
  • Loading branch information
pracucci authored Feb 10, 2022
1 parent a0b153f commit 3b3c664
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 3b3c664

Please sign in to comment.