config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config manages application configuration with GitLab and cache settings

Index

Constants

This section is empty.

Variables

View Source
var ErrConfigNotFound = errors.New("configuration not found")

ErrConfigNotFound is returned when no configuration is found

Functions

func CreateExampleConfig

func CreateExampleConfig() error

CreateExampleConfig creates an example configuration file

func EnsureConfigDir

func EnsureConfigDir() error

EnsureConfigDir ensures the config directory exists

func ExampleConfigPath

func ExampleConfigPath() string

ExampleConfigPath returns the path where the example config should be created

Types

type CacheConfig

type CacheConfig struct {
	Dir string `mapstructure:"dir"`
}

CacheConfig holds cache-specific settings

type Config

type Config struct {
	GitLab        GitLabConfig `mapstructure:"gitlab"`
	Cache         CacheConfig  `mapstructure:"cache"`
	ExcludedPaths []string     `mapstructure:"excluded_paths"`
}

Config holds the application configuration

func Load

func Load() (*Config, error)

Load loads configuration from file and environment variables

func (*Config) AddExclusion

func (c *Config) AddExclusion(pattern string) error

AddExclusion adds a new exclusion pattern if it doesn't already exist

func (*Config) IsExcluded

func (c *Config) IsExcluded(projectPath string) bool

IsExcluded checks if a project path matches any excluded pattern

func (*Config) RemoveExclusion

func (c *Config) RemoveExclusion(pattern string) error

RemoveExclusion removes an exclusion pattern

func (*Config) RemoveExclusionForPath

func (c *Config) RemoveExclusionForPath(projectPath string) error

RemoveExclusionForPath removes any exclusion pattern that matches the given path

func (*Config) Save

func (c *Config) Save() error

Save saves the current configuration to file

type GitLabConfig

type GitLabConfig struct {
	URL     string `mapstructure:"url"`
	Token   string `mapstructure:"token"`
	Timeout int    `mapstructure:"timeout"` // timeout in seconds
}

GitLabConfig holds GitLab-specific settings

func (*GitLabConfig) GetTimeout

func (c *GitLabConfig) GetTimeout() time.Duration

GetTimeout returns the GitLab API timeout as time.Duration

Jump to

Keyboard shortcuts

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