config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config loads the YAML configuration file.

Every key is optional: an empty or absent file yields Default. Unknown keys are an error, so that a typo such as `disable:` for `disabled:` is caught instead of silently running the plugin the operator meant to switch off.

Index

Constants

View Source
const DefaultSpec = "1.7"

DefaultSpec is the CycloneDX version written unless configured otherwise.

Variables

This section is empty.

Functions

func DefaultRoot

func DefaultRoot() string

DefaultRoot is where the host's filesystem is visible by default: "/" on Unix, and the system drive on Windows (a bare "/" there would mean whichever drive the working directory happens to be on).

Types

type Config

type Config struct {
	Output  Output  `yaml:"output"`
	Host    Host    `yaml:"host"`
	Plugins Plugins `yaml:"plugins"`
	PQC     PQC     `yaml:"pqc"`
}

Config is the whole configuration.

func Default

func Default() Config

Default returns the configuration used when nothing is specified.

func Load

func Load(path string) (Config, error)

Load reads path. An empty path returns Default.

func Parse

func Parse(r io.Reader) (Config, error)

Parse reads a configuration from r, layering it over Default.

func (Config) Validate

func (c Config) Validate() error

Validate rejects configurations that cannot work.

type Host

type Host struct {
	// Root is the directory the host's filesystem is visible under: "/" natively,
	// "/host" in a container with the host mounted.
	Root string `yaml:"root"`
	// Name overrides the hostname recorded as the CBOM's subject.
	Name string `yaml:"name"`
	// Redact replaces the host name with a stable label derived from the machine
	// id, so the CBOM does not carry the name. See docs/decisions/ADR-0009.
	Redact bool `yaml:"redact"`
}

Host describes the machine being scanned.

type Output

type Output struct {
	// Path is the file to write, atomically. Empty means standard output.
	Path string `yaml:"path"`
	// Pretty indents the JSON.
	Pretty bool `yaml:"pretty"`
	// Spec is the CycloneDX version written: "1.7" (the default) or "1.6" for consumers that have
	// not moved to 1.7.
	Spec string `yaml:"spec"`
}

Output controls where the CBOM goes.

type PQC

type PQC struct {
	Enabled bool `yaml:"enabled"`
}

PQC controls post-quantum risk annotation.

type Plugins

type Plugins struct {
	// Enabled restricts the run to these sensors; empty means every registered one.
	Enabled []string `yaml:"enabled"`
	// Disabled removes sensors from the run.
	Disabled []string `yaml:"disabled"`
	// Timeout bounds each sensor (Detect plus Collect); 0 disables the bound.
	Timeout time.Duration `yaml:"timeout"`
}

Plugins selects and bounds sensors. (The section keeps its historical name so existing configuration files keep working.)

Jump to

Keyboard shortcuts

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