mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
package config
|
|
|
|
import (
|
|
internalFile "github.com/anchore/syft/internal/file"
|
|
"github.com/anchore/syft/syft/file"
|
|
"github.com/anchore/syft/syft/source"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
type fileContents 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 fileContents) loadDefaultValues(v *viper.Viper) {
|
|
v.SetDefault("file-contents.cataloger.enabled", catalogerEnabledDefault)
|
|
v.SetDefault("file-contents.cataloger.scope", source.SquashedScope)
|
|
v.SetDefault("file-contents.skip-files-above-size", 1*internalFile.MB)
|
|
v.SetDefault("file-contents.globs", []string{})
|
|
}
|
|
|
|
func (cfg *fileContents) parseConfigValues() error {
|
|
return cfg.Cataloger.parseConfigValues()
|
|
}
|
|
|
|
func (cfg fileContents) ToConfig() file.ContentsCatalogerConfig {
|
|
return file.ContentsCatalogerConfig{
|
|
Globs: cfg.Globs,
|
|
SkipFilesAboveSizeInBytes: cfg.SkipFilesAboveSize,
|
|
}
|
|
}
|