config

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config provides Leakwatch configuration management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Scan         ScanConfig         `mapstructure:"scan"`
	Detection    DetectionConfig    `mapstructure:"detection"`
	Verification VerificationConfig `mapstructure:"verification"`
	Filter       FilterConfig       `mapstructure:"filter"`
	Output       OutputConfig       `mapstructure:"output"`
	CustomRules  []custom.RuleDef   `mapstructure:"custom-rules"`
}

Config represents the complete application configuration.

func LoadFrom

func LoadFrom(v *viper.Viper) (*Config, error)

LoadFrom reads configuration from a specific Viper instance and returns a validated Config. Each scan command builds its own isolated Viper (see cmd/scan_common.go) and passes it here, which keeps one command's bound flag defaults from leaking into another command's resolved configuration.

type DetectionConfig

type DetectionConfig struct {
	Entropy EntropyConfig `mapstructure:"entropy"`
}

DetectionConfig holds detection configuration.

type EntropyConfig

type EntropyConfig struct {
	Enabled   bool    `mapstructure:"enabled"`
	Threshold float64 `mapstructure:"threshold"`
}

EntropyConfig holds entropy analysis configuration.

type FilterConfig

type FilterConfig struct {
	ExcludePaths     []string `mapstructure:"exclude-paths"`
	ExcludeDetectors []string `mapstructure:"exclude-detectors"`
}

FilterConfig holds filtering configuration.

type OutputConfig

type OutputConfig struct {
	Format            string `mapstructure:"format"`
	File              string `mapstructure:"file"`
	SeverityThreshold string `mapstructure:"severity-threshold"`
	ShowRaw           bool   `mapstructure:"show-raw"`
}

OutputConfig holds output configuration.

type ScanConfig

type ScanConfig struct {
	Concurrency int   `mapstructure:"concurrency"`
	MaxFileSize int64 `mapstructure:"max-file-size"`
}

ScanConfig holds scan engine configuration.

type VerificationConfig

type VerificationConfig struct {
	Enabled     bool          `mapstructure:"enabled"`
	Timeout     time.Duration `mapstructure:"timeout"`
	Concurrency int           `mapstructure:"concurrency"`
	RateLimit   float64       `mapstructure:"rate-limit"`
}

VerificationConfig holds secret verification configuration.

Jump to

Keyboard shortcuts

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