Documentation
¶
Index ¶
- Constants
- func CreateDefault(path string) error
- func DefaultConfigPath() string
- func Exists(path string) bool
- func IsRemote(path string) bool
- func SourcesDirPath() string
- func ValidateFile(path string) error
- type Config
- type FileStrategy
- type RegexStrategy
- type RepoEntry
- type SSHOptions
- type Source
- type Strategy
Constants ¶
const DefaultTemplate = `` /* 526-byte string literal not displayed */
DefaultTemplate is the template for new config files
Variables ¶
This section is empty.
Functions ¶
func CreateDefault ¶
CreateDefault creates a default config file at the given path
func DefaultConfigPath ¶
func DefaultConfigPath() string
func Exists ¶
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 SourcesDirPath ¶ added in v0.7.1
func SourcesDirPath() string
SourcesDirPath returns the path to the sources.d directory
func ValidateFile ¶
ValidateFile validates a config file without loading it fully
Types ¶
type Config ¶
type Config struct {
Sources []Source `yaml:"sources"`
}
func (*Config) ExpandPaths ¶
func (c *Config) ExpandPaths()
func (*Config) ValidateCredentials ¶
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 RepoEntry ¶ added in v0.8.0
RepoEntry represents a repository in the config. It supports both plain string format ("user/repo") and object format with an optional local_path override.
func RepoEntriesFromNames ¶ added in v0.8.0
RepoEntriesFromNames converts a slice of repo name strings to a RepoEntry slice.
func (RepoEntry) HasCustomLocalPath ¶ added in v0.8.0
HasCustomLocalPath returns true if this repo has a custom local_path override.
func (RepoEntry) MarshalYAML ¶ added in v0.8.0
MarshalYAML emits a plain string when no LocalPath is set, or an object otherwise.
func (RepoEntry) ResolvedLocalPath ¶ added in v0.8.0
ResolvedLocalPath returns the effective local path for this repo. If LocalPath is set, it returns that; otherwise filepath.Join(sourceLocalPath, baseName).
type SSHOptions ¶
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 []RepoEntry `yaml:"repos,omitempty"`
}
func (*Source) GetBranch ¶
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) GetPrivateKey ¶
GetPrivateKey returns the SSH private key path, checking both locations
func (*Source) GetRepoURL ¶
func (*Source) GetUserOrOrg ¶
GetUserOrOrg extracts the user/org from the source field