File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change 8
8
log "github.com/sirupsen/logrus"
9
9
flag "github.com/spf13/pflag"
10
10
11
+ "slices"
12
+
11
13
"github.com/go-viper/mapstructure/v2"
12
14
"github.com/spf13/viper"
13
15
)
@@ -374,23 +376,14 @@ func init() {
374
376
375
377
// Print out all configuration options except secret stuff.
376
378
func Print (redacted []string ) {
377
- ok := func (key string ) bool {
378
- for _ , forbiddenKey := range redacted {
379
- if forbiddenKey == key {
380
- return false
381
- }
382
- }
383
- return true
384
- }
385
-
386
379
var keys sort.StringSlice = viper .AllKeys ()
387
380
388
381
keys .Sort ()
389
382
for _ , key := range keys {
390
- if ok (key ) {
391
- log .Printf ("%s: %v" , key , viper .Get (key ))
392
- } else {
383
+ if slices .Contains (redacted , key ) {
393
384
log .Printf ("%s: ***REDACTED***" , key )
385
+ } else {
386
+ log .Printf ("%s: %v" , key , viper .Get (key ))
394
387
}
395
388
}
396
389
}
You can’t perform that action at this time.
0 commit comments