config

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTemplate = `` /* 526-byte string literal not displayed */

DefaultTemplate is the template for new config files

Variables

This section is empty.

Functions

func CreateDefault

func CreateDefault(path string) error

CreateDefault creates a default config file at the given path

func DefaultConfigPath

func DefaultConfigPath() string

func Exists

func Exists(path string) bool

Exists checks if a config file exists at the given path For remote URLs (HTTP/SSH), always returns true (validation will fail if not accessible)

func IsRemote

func IsRemote(path string) bool

IsRemote checks if the path is a remote URL (HTTP or SSH)

func SourcesDirPath added in v0.7.1

func SourcesDirPath() string

SourcesDirPath returns the path to the sources.d directory

func ValidateFile

func ValidateFile(path string) error

ValidateFile validates a config file without loading it fully

Types

type Config

type Config struct {
	Sources []Source `yaml:"sources"`
}

func Load

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

func (*Config) ExpandPaths

func (c *Config) ExpandPaths()

func (*Config) Save

func (c *Config) Save(path string) error

func (*Config) Validate

func (c *Config) Validate() error

func (*Config) ValidateCredentials

func (c *Config) ValidateCredentials() []string

ValidateCredentials checks that required API tokens are available for non-manual strategies

type FileStrategy

type FileStrategy struct {
	Filename string `yaml:"filename"`
}

type RegexStrategy

type RegexStrategy struct {
	Pattern string `yaml:"pattern"`
}

type SSHOptions

type SSHOptions struct {
	Port       int    `yaml:"port,omitempty"`
	PrivateKey string `yaml:"private_key,omitempty"`
}

type Source

type Source struct {
	Name          string        `yaml:"name"`
	Source        string        `yaml:"source"`
	Strategy      Strategy      `yaml:"strategy"`
	Type          string        `yaml:"type,omitempty"` // "github", "gitea", "bitbucket", or auto-detect from host
	FileStrategy  FileStrategy  `yaml:"file_strategy,omitempty"`
	RegexStrategy RegexStrategy `yaml:"regex_strategy,omitempty"`
	LocalPath     string        `yaml:"local_path"`
	SSHOptions    SSHOptions    `yaml:"ssh_options,omitempty"`
	PrivateKey    string        `yaml:"private_key,omitempty"` // deprecated: use ssh_options.private_key
	Branch        string        `yaml:"branch,omitempty"`
	Repos         []string      `yaml:"repos,omitempty"`
}

func (*Source) GetBranch

func (s *Source) GetBranch() string

GetBranch returns the configured branch, or empty string to use remote default

func (*Source) GetConnectorType

func (s *Source) GetConnectorType() connector.ConnectorType

GetConnectorType returns the connector type for this source

func (*Source) GetHost

func (s *Source) GetHost() string

GetHost extracts the host from the source field

func (*Source) GetPrivateKey

func (s *Source) GetPrivateKey() string

GetPrivateKey returns the SSH private key path, checking both locations

func (*Source) GetRepoURL

func (s *Source) GetRepoURL(repo string) string

func (*Source) GetUserOrOrg

func (s *Source) GetUserOrOrg() string

GetUserOrOrg extracts the user/org from the source field

type Strategy

type Strategy string
const (
	StrategyManual Strategy = "manual"
	StrategyAll    Strategy = "all"
	StrategyFile   Strategy = "file"
	StrategyRegex  Strategy = "regex"
)

Jump to

Keyboard shortcuts

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