github.com/nextlinux/gosbom@v0.81.1-0.20230627115839-1ff50c281391/internal/config/secrets.go (about) 1 package config 2 3 import ( 4 "github.com/nextlinux/gosbom/gosbom/source" 5 "github.com/nextlinux/gosbom/internal/file" 6 "github.com/spf13/viper" 7 ) 8 9 type secrets struct { 10 Cataloger catalogerOptions `yaml:"cataloger" json:"cataloger" mapstructure:"cataloger"` 11 AdditionalPatterns map[string]string `yaml:"additional-patterns" json:"additional-patterns" mapstructure:"additional-patterns"` 12 ExcludePatternNames []string `yaml:"exclude-pattern-names" json:"exclude-pattern-names" mapstructure:"exclude-pattern-names"` 13 RevealValues bool `yaml:"reveal-values" json:"reveal-values" mapstructure:"reveal-values"` 14 SkipFilesAboveSize int64 `yaml:"skip-files-above-size" json:"skip-files-above-size" mapstructure:"skip-files-above-size"` 15 } 16 17 func (cfg secrets) loadDefaultValues(v *viper.Viper) { 18 v.SetDefault("secrets.cataloger.enabled", catalogerEnabledDefault) 19 v.SetDefault("secrets.cataloger.scope", source.AllLayersScope) 20 v.SetDefault("secrets.reveal-values", false) 21 v.SetDefault("secrets.skip-files-above-size", 1*file.MB) 22 v.SetDefault("secrets.additional-patterns", map[string]string{}) 23 v.SetDefault("secrets.exclude-pattern-names", []string{}) 24 } 25 26 func (cfg *secrets) parseConfigValues() error { 27 return cfg.Cataloger.parseConfigValues() 28 }