github.com/kastenhq/syft@v0.0.0-20230821225854-0710af25cdbe/internal/config/file_contents.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 fileContents struct {
    11  	Cataloger          catalogerOptions `yaml:"cataloger" json:"cataloger" mapstructure:"cataloger"`
    12  	SkipFilesAboveSize int64            `yaml:"skip-files-above-size" json:"skip-files-above-size" mapstructure:"skip-files-above-size"`
    13  	Globs              []string         `yaml:"globs" json:"globs" mapstructure:"globs"`
    14  }
    15  
    16  func (cfg fileContents) loadDefaultValues(v *viper.Viper) {
    17  	v.SetDefault("file-contents.cataloger.enabled", catalogerEnabledDefault)
    18  	v.SetDefault("file-contents.cataloger.scope", source.SquashedScope)
    19  	v.SetDefault("file-contents.skip-files-above-size", 1*file.MB)
    20  	v.SetDefault("file-contents.globs", []string{})
    21  }
    22  
    23  func (cfg *fileContents) parseConfigValues() error {
    24  	return cfg.Cataloger.parseConfigValues()
    25  }