config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config handles loading configuration from .gonerc.yaml files.

Index

Constants

View Source
const DefaultConfigFileName = ".gonerc.yaml"

DefaultConfigFileName is the default configuration file name.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Ignore IgnoreConfig `yaml:"ignore"`
}

Config represents the complete configuration structure.

func FindAndLoad

func FindAndLoad(startDir string) (*Config, error)

FindAndLoad searches for a config file starting from the given directory and walking up to parent directories until it finds one or reaches root. This allows project-specific configs to be found from subdirectories.

func Load

func Load() (*Config, error)

Load reads configuration from .gonerc.yaml in the current directory. Returns an empty config if the file doesn't exist (not an error). Returns an error only if the file exists but cannot be parsed.

func LoadFrom

func LoadFrom(path string) (*Config, error)

LoadFrom reads configuration from a specific path. Returns an empty config if the file doesn't exist (not an error). Returns an error only if the file exists but cannot be parsed.

func (*Config) IsEmpty

func (c *Config) IsEmpty() bool

IsEmpty returns true if the config has no ignore rules defined.

func (*Config) Merge

func (c *Config) Merge(other *Config)

Merge combines another config into this one (additive). This is useful for merging CLI flags with file config.

type IgnoreConfig

type IgnoreConfig struct {
	// Domains to ignore (automatically includes subdomains).
	// Example: "example.com" will also match "www.example.com", "api.example.com".
	Domains []string `yaml:"domains"`

	// Patterns are glob patterns for URL matching.
	// Example: "*.local/*", "*/internal/*"
	Patterns []string `yaml:"patterns"`

	// Regex are regular expression patterns for URL matching.
	// Example: ".*\\.test$", ".*/v[0-9]+/draft/.*"
	Regex []string `yaml:"regex"`
}

IgnoreConfig holds all ignore rules.

Jump to

Keyboard shortcuts

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