github.com/kastenhq/syft@v0.0.0-20230821225854-0710af25cdbe/internal/config/secrets.go (about)

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