Skip to content

Commit

Permalink
Make flagext.Secret value unexported. (#154)
Browse files Browse the repository at this point in the history
* Make flagext.Secret value unexported.

* CHANGELOG.md
  • Loading branch information
pstibrany committed Mar 31, 2022
1 parent 6d48ca0 commit d031b36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* [CHANGE] Lifecycler: Default value of lifecycler's `final-sleep` is now `0s` (i.e. no sleep). #121
* [CHANGE] Lifecycler: It's now possible to change default value of lifecycler's `final-sleep`. #121
* [CHANGE] Minor cosmetic changes in ring and memberlist HTTP status templates. #149
* [CHANGE] flagext.Secret: `value` field is no longer exported. Value can be read using `String()` method and set using `Set` method. #154
* [ENHANCEMENT] Add middleware package. #38
* [ENHANCEMENT] Add the ring package #45
* [ENHANCEMENT] Add limiter package. #41
Expand Down
8 changes: 4 additions & 4 deletions flagext/secret.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package flagext

type Secret struct {
Value string
value string
}

// String implements flag.Value
func (v Secret) String() string {
return v.Value
return v.value
}

// Set implements flag.Value
func (v *Secret) Set(s string) error {
v.Value = s
v.value = s
return nil
}

Expand All @@ -27,7 +27,7 @@ func (v *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error {

// MarshalYAML implements yaml.Marshaler.
func (v Secret) MarshalYAML() (interface{}, error) {
if len(v.Value) == 0 {
if len(v.value) == 0 {
return "", nil
}
return "********", nil
Expand Down

0 comments on commit d031b36

Please sign in to comment.