config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(dir string) bool

Exists returns true if a .pgspectre.yml file is found in dir or ~/.

Types

type Config

type Config struct {
	DBURL      string     `yaml:"db_url"`
	Schemas    []string   `yaml:"schemas"`
	Thresholds Thresholds `yaml:"thresholds"`
	Exclude    Exclude    `yaml:"exclude"`
	Defaults   Defaults   `yaml:"defaults"`
}

Config holds all pgspectre configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the built-in defaults.

func Load

func Load(dir string) (Config, error)

Load reads configuration from .pgspectre.yml in the given directory, falling back to ~/.pgspectre.yml. Returns DefaultConfig if no file found.

func (*Config) TimeoutDuration

func (c *Config) TimeoutDuration() time.Duration

TimeoutDuration parses the Defaults.Timeout string as a time.Duration. Returns 30s if parsing fails.

type Defaults

type Defaults struct {
	Format  string `yaml:"format"`
	Timeout string `yaml:"timeout"` // parsed as time.Duration
}

Defaults holds default CLI flag values.

type Exclude

type Exclude struct {
	Tables   []string `yaml:"tables"`
	Schemas  []string `yaml:"schemas"`
	Findings []string `yaml:"findings"`
}

Exclude lists tables, schemas, and finding types to skip during analysis.

type Thresholds

type Thresholds struct {
	VacuumDays          int   `yaml:"vacuum_days"`            // days since last autovacuum to flag
	UnusedIndexMinBytes int64 `yaml:"unused_index_min_bytes"` // minimum unused index size to report
	BloatMinBytes       int64 `yaml:"bloat_min_bytes"`        // minimum index size to flag as bloated
}

Thresholds control detection sensitivity.

Jump to

Keyboard shortcuts

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