add file contents cataloger

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2021-04-12 17:30:57 -04:00
parent 9ad786d608
commit c1551a03c5
10 changed files with 261 additions and 2 deletions
+1
View File
@@ -38,6 +38,7 @@ type Application struct {
Package packages `yaml:"package" json:"package" mapstructure:"package"`
FileMetadata FileMetadata `yaml:"file-metadata" json:"file-metadata" mapstructure:"file-metadata"`
FileClassification fileClassification `yaml:"file-classification" json:"file-classification" mapstructure:"file-classification"`
Contents contents `yaml:"contents" json:"contents" mapstructure:"contents"`
Secrets secrets `yaml:"secrets" json:"secrets" mapstructure:"secrets"`
}
+24
View File
@@ -0,0 +1,24 @@
package config
import (
"github.com/anchore/syft/internal/file"
"github.com/anchore/syft/syft/source"
"github.com/spf13/viper"
)
type contents struct {
Cataloger catalogerOptions `yaml:"cataloger" json:"cataloger" mapstructure:"cataloger"`
SkipFilesAboveSize int64 `yaml:"skip-files-above-size" json:"skip-files-above-size" mapstructure:"skip-files-above-size"`
Globs []string `yaml:"globs" json:"globs" mapstructure:"globs"`
}
func (cfg contents) loadDefaultValues(v *viper.Viper) {
v.SetDefault("contents.cataloger.enabled", true)
v.SetDefault("contents.cataloger.scope", source.SquashedScope)
v.SetDefault("contents.skip-files-above-size", 1*file.MB)
v.SetDefault("contents.globs", []string{})
}
func (cfg *contents) parseConfigValues() error {
return cfg.Cataloger.parseConfigValues()
}