config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package config loads Redactyl configuration from local and global YAML files with precedence rules. It is internal; CLI code maps flags and files into engine configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileConfig

type FileConfig struct {
	Include           *string  `yaml:"include"`
	Exclude           *string  `yaml:"exclude"`
	MaxBytes          *int64   `yaml:"max_bytes"`
	Enable            *string  `yaml:"enable"`
	Disable           *string  `yaml:"disable"`
	Threads           *int     `yaml:"threads"`
	MinConfidence     *float64 `yaml:"min_confidence"`
	NoColor           *bool    `yaml:"no_color"`
	DefaultExcludes   *bool    `yaml:"default_excludes"`
	NoValidators      *bool    `yaml:"no_validators"`
	NoStructured      *bool    `yaml:"no_structured"`
	VerifyMode        *string  `yaml:"verify"`
	DisableValidators *string  `yaml:"disable_validators"`
	DisableStructured *string  `yaml:"disable_structured"`

	// Deep scanning config mirrors CLI flags
	Archives             *bool   `yaml:"archives"`
	Containers           *bool   `yaml:"containers"`
	IaC                  *bool   `yaml:"iac"`
	Helm                 *bool   `yaml:"helm"`
	K8s                  *bool   `yaml:"k8s"`
	MaxArchiveBytes      *int64  `yaml:"max_archive_bytes"`
	MaxEntries           *int    `yaml:"max_entries"`
	MaxDepth             *int    `yaml:"max_depth"`
	ScanTimeBudget       *string `yaml:"scan_time_budget"`
	GlobalArtifactBudget *string `yaml:"global_artifact_budget"`

	// Gitleaks integration config
	Gitleaks *GitleaksConfig `yaml:"gitleaks"`
}

FileConfig is the on-disk YAML configuration shape for Redactyl.

func LoadFile

func LoadFile(path string) (FileConfig, error)

LoadFile reads a YAML config file from the provided path.

func LoadGlobal

func LoadGlobal() (FileConfig, error)

LoadGlobal loads the global config file from XDG base directory or ~/.config.

func LoadLocal

func LoadLocal(repoRoot string) (FileConfig, error)

LoadLocal searches for a repo-local config file in the given root. It supports .redactyl.yml/.yaml and redactyl.yml/.yaml.

func (FileConfig) GetGitleaksConfig

func (fc FileConfig) GetGitleaksConfig() GitleaksConfig

GetGitleaksConfig returns the Gitleaks configuration with sensible defaults.

type GitleaksConfig

type GitleaksConfig struct {
	// ConfigPath is the path to a .gitleaks.toml configuration file.
	// If empty, Gitleaks will use its default rules.
	ConfigPath *string `yaml:"config"`

	// BinaryPath is an explicit path to the gitleaks binary.
	// If empty, the binary will be searched in $PATH and ~/.redactyl/bin.
	BinaryPath *string `yaml:"binary"`

	// AutoDownload enables automatic downloading of the gitleaks binary
	// if it's not found. Defaults to true.
	AutoDownload *bool `yaml:"auto_download"`

	// Version pins a specific version of gitleaks to use/download.
	// If empty, the latest available version will be used.
	Version *string `yaml:"version"`
}

GitleaksConfig holds configuration for Gitleaks integration.

func (GitleaksConfig) GetBinaryPath

func (gc GitleaksConfig) GetBinaryPath() string

GetGitleaksBinaryPath returns the custom binary path or empty string.

func (GitleaksConfig) GetConfigPath

func (gc GitleaksConfig) GetConfigPath() string

GetGitleaksConfigPath returns the config file path or empty string.

func (GitleaksConfig) GetVersion

func (gc GitleaksConfig) GetVersion() string

GetVersion returns the pinned version or empty string for latest.

func (GitleaksConfig) IsAutoDownloadEnabled

func (gc GitleaksConfig) IsAutoDownloadEnabled() bool

IsAutoDownloadEnabled returns true if auto-download is enabled (default: true).

Jump to

Keyboard shortcuts

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