mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
24 lines
532 B
Go
24 lines
532 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"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) build() error {
|
|
scopeOption := source.ParseScope(cfg.Scope)
|
|
if scopeOption == source.UnknownScope {
|
|
return fmt.Errorf("bad scope value %q", cfg.Scope)
|
|
}
|
|
cfg.ScopeOpt = scopeOption
|
|
|
|
return nil
|
|
}
|