config

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(c *cobra.Command, v *viper.Viper)

AddFlags, walks through config.Check struct and bind its Member to Cobra command and add respective Viper flag

Types

type Check

type Check struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Remediation string                 `json:"remediation"`
	Scope       *ObjectKindsDesc       `json:"scope"`
	Template    string                 `json:"template"`
	Params      map[string]interface{} `json:"params,omitempty"`
}

A Check represents a single check. It is serializable.

type ChecksConfig

type ChecksConfig struct {
	// AddAllBuiltIn, if set, adds all built-in checks. This allows users to
	// explicitly opt-out of checks that are not relevant using Exclude.
	// +flagName=add-all-built-in
	AddAllBuiltIn bool `json:"addAllBuiltIn"`
	// DoNotAutoAddDefaults, if set, prevents the automatic addition of default checks.
	// +flagName=do-not-auto-add-defaults
	DoNotAutoAddDefaults bool `json:"doNotAutoAddDefaults"`
	// Exclude is a list of check names to exclude.
	// +flagName=exclude
	Exclude []string `json:"exclude"`
	// Include is a list of check names to include. If a check is in both Include and Exclude,
	// Exclude wins.
	// +flagName=include
	Include []string `json:"include"`
	// IgnorePaths is a list of path to ignore from applying checks
	// +flagName=ignore-paths
	IgnorePaths []string `json:"ignorePaths"`
}

ChecksConfig is the config that determines which checks to run.

type Config

type Config struct {
	// +flagName=-
	CustomChecks []Check      `json:"customChecks,omitempty"`
	Checks       ChecksConfig `json:"checks,omitempty"`
}

Config represents the config file format.

func Load

func Load(v *viper.Viper, configPath string) (Config, error)

Load loads the config from the given path.

type ObjectKindsDesc

type ObjectKindsDesc struct {
	ObjectKinds []string `json:"objectKinds"`
}

ObjectKindsDesc describes a list of supported object kinds for a check template.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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