mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
* add support for searching jars within archives Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add package cataloger config options Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * address review comments + factor out safeCopy helper Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update config docs regarding package archive search options Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * show that unindexed archive cataloging defaults to false Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * remove lies about -s Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * address review comments Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update search archive note about java Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
30 lines
687 B
Go
30 lines
687 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
"github.com/anchore/syft/syft/source"
|
|
)
|
|
|
|
type catalogerOptions struct {
|
|
Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
|
|
Scope string `yaml:"scope" json:"scope" mapstructure:"scope"`
|
|
ScopeOpt source.Scope `yaml:"-" json:"-"`
|
|
}
|
|
|
|
func (cfg catalogerOptions) loadDefaultValues(v *viper.Viper) {
|
|
v.SetDefault("package.cataloger.enabled", true)
|
|
}
|
|
|
|
func (cfg *catalogerOptions) parseConfigValues() error {
|
|
scopeOption := source.ParseScope(cfg.Scope)
|
|
if scopeOption == source.UnknownScope {
|
|
return fmt.Errorf("bad scope value %q", cfg.Scope)
|
|
}
|
|
cfg.ScopeOpt = scopeOption
|
|
|
|
return nil
|
|
}
|