config

package
v0.0.0-...-7dfc719 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfigPath = "/etc/fake-scanner/config.yaml"

DefaultConfigPath ...

Functions

This section is empty.

Types

type Config

type Config struct {
	DB struct {
		// The total count of the vulnerabilities in db
		Total int64 `config:"db-total"`
	}

	Scanner struct {
		// The count of the scan workers
		Workers int `config:"scanner-workers"`

		// Skip pulling the artifact from registry when it's true
		SkipPulling bool `config:"scanner-skip-pulling" yaml:"skipPulling"`

		// The rate when scan failed for the artifact
		ErrorRate float64 `config:"scanner-error-rate" yaml:"errorRate"`

		// The rate when there are vulnerabilities for the artifact
		VulnerableRate float64 `config:"scanner-vulnerable-rate" yaml:"vulnerableRate"`

		// The vulnerabilities count in the artifact
		VulnerabilitiesPerReport int64 `config:"scanner-vulnerabilities-per-report" yaml:"vulnerabilitiesPerReport"`

		// The package count in the SBOM of an artifact
		SbomPackagesPerReport int64 `config:"sbom-packages-per-report" yaml:"sbomPackagesPerReport"`

		// The duration to generate the scan report after artifact pulled
		ReportGeneratingDuration time.Duration `config:"scanner-report-generating-duration" yaml:"reportGeneratingDuration"`
	}

	Server struct {
		// The address the scanner listend
		Address string `config:"server-address"`

		// The access request will be logged when it's true
		AsscessLog bool `config:"server-access-log" yaml:"accessLog"`

		Delay struct {
			// The dealy duration of the metadata API
			Metadata time.Duration `config:"server-delay-metadata" yaml:"metadata"`
			// The dealy duration of the accept scan request API
			AcceptScanRequest time.Duration `config:"server-delay-accept-scan-request" yaml:"acceptScanRequest"`
			// The dealy duration of the get scan report API
			GetScanReport time.Duration `config:"server-delay-get-scan-report" yaml:"getScanReport"`
		}

		// A timeout will be returned when the APIs don't response after this time duration
		Timeout time.Duration `config:"server-timeout"`
	}
}

Config -- db:

total: 10000

scanner:

workers: 100
skipPulling: true
errorRate: 0
vulnerableRate: 1
vulnerabilitiesPerReport: 100
reportGeneratingDuration: 0s

server:

address: 0.0.0.0:8080
accessLog: true
timeout: 0s
delay:
  metadata: 0s
  acceptScanRequest: 0s
  getScanReport: 0s

func Load

func Load(paths ...string) (*Config, error)

func (*Config) Validate

func (cfg *Config) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL