Skip to content

Commit f23580e

Browse files
committed
Ensure settings are redacted.
Signed-off-by: Jeff Ortel <[email protected]>
1 parent a7db576 commit f23580e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func printHeap() {
128128

129129
// main.
130130
func main() {
131-
log.Info("Started", "settings", Settings)
131+
log.Info("Started:\n" + Settings.String())
132132
var err error
133133
defer func() {
134134
if err != nil {

settings/all.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package settings
33
import (
44
"os"
55
"strconv"
6+
7+
"gopkg.in/yaml.v2"
68
)
79

810
var Settings TackleSettings
@@ -34,6 +36,15 @@ func (r *TackleSettings) Load() (err error) {
3436
return
3537
}
3638

39+
// String returns a YAML representation.
40+
// Redacted as needed.
41+
func (r TackleSettings) String() (s string) {
42+
r.Encryption.Passphrase = "********"
43+
b, _ := yaml.Marshal(r)
44+
s = string(b)
45+
return
46+
}
47+
3748
// Get boolean.
3849
func getEnvBool(name string, def bool) bool {
3950
boolean := def

0 commit comments

Comments
 (0)