mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
migrate cataloging config to separate source file
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
parent
3323ce2b6b
commit
a70cfa6dd7
47
syft/cataloging_config.go
Normal file
47
syft/cataloging_config.go
Normal file
@ -0,0 +1,47 @@
|
||||
package syft
|
||||
|
||||
import (
|
||||
"crypto"
|
||||
|
||||
"github.com/anchore/syft/internal"
|
||||
"github.com/anchore/syft/internal/version"
|
||||
"github.com/anchore/syft/syft/file"
|
||||
"github.com/anchore/syft/syft/pkg"
|
||||
"github.com/anchore/syft/syft/source"
|
||||
)
|
||||
|
||||
type CatalogingConfig struct {
|
||||
// tool-specific information
|
||||
ToolName string
|
||||
ToolVersion string
|
||||
ToolConfiguration interface{}
|
||||
// applies to all catalogers
|
||||
Scope source.Scope
|
||||
ProcessTasksInSerial bool
|
||||
// package
|
||||
PackageCatalogers []pkg.Cataloger
|
||||
// file metadata
|
||||
CaptureFileMetadata bool
|
||||
DigestHashes []crypto.Hash
|
||||
// secrets
|
||||
CaptureSecrets bool
|
||||
SecretsConfig file.SecretsCatalogerConfig
|
||||
SecretsScope source.Scope
|
||||
// file classification
|
||||
ClassifyFiles bool
|
||||
FileClassifiers []file.Classifier
|
||||
// file contents
|
||||
ContentsConfig file.ContentsCatalogerConfig
|
||||
}
|
||||
|
||||
func DefaultCatalogingConfig() CatalogingConfig {
|
||||
return CatalogingConfig{
|
||||
Scope: source.SquashedScope,
|
||||
ToolName: internal.ApplicationName,
|
||||
ToolVersion: version.Guess(),
|
||||
SecretsScope: source.AllLayersScope,
|
||||
SecretsConfig: file.DefaultSecretsCatalogerConfig(),
|
||||
FileClassifiers: file.DefaultClassifiers(),
|
||||
ContentsConfig: file.DefaultContentsCatalogerConfig(),
|
||||
}
|
||||
}
|
||||
@ -2,50 +2,12 @@ package syft
|
||||
|
||||
import (
|
||||
"crypto"
|
||||
"github.com/anchore/syft/internal"
|
||||
"github.com/anchore/syft/internal/version"
|
||||
"github.com/anchore/syft/syft/file"
|
||||
"github.com/anchore/syft/syft/pkg"
|
||||
"github.com/anchore/syft/syft/pkg/cataloger/packages"
|
||||
"github.com/anchore/syft/syft/source"
|
||||
)
|
||||
|
||||
type CatalogingConfig struct {
|
||||
// tool-specific information
|
||||
ToolName string
|
||||
ToolVersion string
|
||||
ToolConfiguration interface{}
|
||||
// applies to all catalogers
|
||||
Scope source.Scope
|
||||
ProcessTasksInSerial bool
|
||||
// package
|
||||
PackageCatalogers []pkg.Cataloger
|
||||
// file metadata
|
||||
CaptureFileMetadata bool
|
||||
DigestHashes []crypto.Hash
|
||||
// secrets
|
||||
CaptureSecrets bool
|
||||
SecretsConfig file.SecretsCatalogerConfig
|
||||
SecretsScope source.Scope
|
||||
// file classification
|
||||
ClassifyFiles bool
|
||||
FileClassifiers []file.Classifier
|
||||
// file contents
|
||||
ContentsConfig file.ContentsCatalogerConfig
|
||||
}
|
||||
|
||||
func DefaultCatalogingConfig() CatalogingConfig {
|
||||
return CatalogingConfig{
|
||||
Scope: source.SquashedScope,
|
||||
ToolName: internal.ApplicationName,
|
||||
ToolVersion: version.Guess(),
|
||||
SecretsScope: source.AllLayersScope,
|
||||
SecretsConfig: file.DefaultSecretsCatalogerConfig(),
|
||||
FileClassifiers: file.DefaultClassifiers(),
|
||||
ContentsConfig: file.DefaultContentsCatalogerConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
type CatalogingOption func(*source.Source, *CatalogingConfig) error
|
||||
|
||||
func WithConfig(override CatalogingConfig) CatalogingOption {
|
||||
|
||||
@ -117,11 +117,6 @@ func generateCatalogSecretsTask(config CatalogingConfig) (task, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
//patterns, err := file.GenerateSearchPatterns(file.DefaultSecretsPatterns, appConfig.Secrets.AdditionalPatterns, appConfig.Secrets.ExcludePatternNames)
|
||||
//if err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
|
||||
secretsCataloger, err := file.NewSecretsCataloger(config.SecretsConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user