github.com/lineaje-labs/syft@v0.98.1-0.20231227153149-9e393f60ff1b/syft/pkg/cataloger/config.go (about) 1 package cataloger 2 3 import ( 4 "github.com/anchore/syft/syft/cataloging" 5 "github.com/anchore/syft/syft/pkg/cataloger/golang" 6 "github.com/anchore/syft/syft/pkg/cataloger/java" 7 "github.com/anchore/syft/syft/pkg/cataloger/kernel" 8 "github.com/anchore/syft/syft/pkg/cataloger/python" 9 ) 10 11 // TODO: these field naming vs helper function naming schemes are inconsistent. 12 type Config struct { 13 Search SearchConfig 14 Golang golang.CatalogerConfig 15 LinuxKernel kernel.LinuxKernelCatalogerConfig 16 Python python.CatalogerConfig 17 Java java.ArchiveCatalogerConfig 18 Catalogers []string 19 Parallelism int 20 ExcludeBinaryOverlapByOwnership bool 21 CleanupDisabled bool 22 } 23 24 func DefaultConfig() Config { 25 return Config{ 26 Search: DefaultSearchConfig(), 27 Parallelism: 1, 28 LinuxKernel: kernel.DefaultLinuxCatalogerConfig(), 29 Python: python.DefaultCatalogerConfig(), 30 Java: java.DefaultArchiveCatalogerConfig(), 31 ExcludeBinaryOverlapByOwnership: true, 32 } 33 } 34 35 // JavaConfig merges relevant config values from Config to return a java.Config struct. 36 // Values like IncludeUnindexedArchives and IncludeIndexedArchives are used across catalogers 37 // and are not specific to Java requiring this merge. 38 func (c Config) JavaConfig() java.ArchiveCatalogerConfig { 39 return java.ArchiveCatalogerConfig{ 40 ArchiveSearchConfig: cataloging.ArchiveSearchConfig{ 41 IncludeUnindexedArchives: c.Search.IncludeUnindexedArchives, 42 IncludeIndexedArchives: c.Search.IncludeIndexedArchives, 43 }, 44 UseNetwork: c.Java.UseNetwork, 45 MavenBaseURL: c.Java.MavenBaseURL, 46 MaxParentRecursiveDepth: c.Java.MaxParentRecursiveDepth, 47 } 48 }