Documentation
¶
Overview ¶
Package config provides configuration management for DependaBot
Index ¶
- type ConfigReader
- func (c *ConfigReader) ApplyDefaults(config *DependaBotConfig) *DependaBotConfig
- func (c *ConfigReader) MergeConfigs(configs ...*DependaBotConfig) *DependaBotConfig
- func (c *ConfigReader) ReadExternalConfig(configPath string) (*DependaBotConfig, error)
- func (c *ConfigReader) ReadRepoConfig(projectPath string) (*DependaBotConfig, error)
- type DependaBotConfig
- type GitHubDependabotConfig
- type GitHubDependabotUpdateConfig
- type GitProviderConfig
- type GoUpdaterConfig
- type HookConfig
- type HooksConfig
- type NoticeConfig
- type PRConfig
- type PipelineScannerConfig
- type RepoConfig
- type ScannerConfig
- type UpdaterConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigReader ¶
type ConfigReader struct{}
ConfigReader handles reading and merging configuration files
func NewConfigReader ¶
func NewConfigReader() *ConfigReader
NewConfigReader creates a new configuration reader
func (*ConfigReader) ApplyDefaults ¶
func (c *ConfigReader) ApplyDefaults(config *DependaBotConfig) *DependaBotConfig
ApplyDefaults applies default values to configuration
func (*ConfigReader) MergeConfigs ¶
func (c *ConfigReader) MergeConfigs(configs ...*DependaBotConfig) *DependaBotConfig
MergeConfigs merges multiple configurations with priority order Later configurations override earlier ones
func (*ConfigReader) ReadExternalConfig ¶
func (c *ConfigReader) ReadExternalConfig(configPath string) (*DependaBotConfig, error)
ReadExternalConfig reads configuration from external file specified by CLI
func (*ConfigReader) ReadRepoConfig ¶
func (c *ConfigReader) ReadRepoConfig(projectPath string) (*DependaBotConfig, error)
ReadRepoConfig reads configuration from repository configuration files Supports both legacy format and GitHub Dependabot format Searches for configuration files in the following order: 1. .dependabot.yml in project root directory 2. .dependabot.yaml in project root directory 3. .github/dependabot.yml 4. .github/dependabot.yaml
type DependaBotConfig ¶
type DependaBotConfig struct {
// Repo contains repository information
Repo RepoConfig `yaml:"repo" json:"repo" mapstructure:"repo"`
// PR contains PR-specific configuration
PR PRConfig `yaml:"pr" json:"pr" mapstructure:"pr"`
// Scanner contains scanner configuration (supports multiple scanner types)
Scanner ScannerConfig `yaml:"scanner" json:"scanner" mapstructure:"scanner"`
// Git contains git provider configuration
Git GitProviderConfig `yaml:"git" json:"git" mapstructure:"git"`
// Notice contains notice configuration
Notice NoticeConfig `yaml:"notice" json:"notice" mapstructure:"notice"`
// Hooks contains custom script configuration for pipeline hooks
Hooks HooksConfig `yaml:"hooks" json:"hooks" mapstructure:"hooks"`
// Updater contains updater-specific configuration
Updater UpdaterConfig `yaml:"updater" json:"updater" mapstructure:"updater"`
}
DependaBotConfig represents the complete configuration for DependaBot (legacy format)
func (*DependaBotConfig) String ¶
func (c *DependaBotConfig) String() string
String implements fmt.Stringer interface for better debugging experience
type GitHubDependabotConfig ¶
type GitHubDependabotConfig struct {
Version int `yaml:"version" json:"version"`
Updates []GitHubDependabotUpdateConfig `yaml:"updates" json:"updates"`
}
GitHubDependabotConfig represents GitHub Dependabot compatible configuration
type GitHubDependabotUpdateConfig ¶
type GitHubDependabotUpdateConfig struct {
PackageEcosystem string `yaml:"package-ecosystem" json:"package-ecosystem"`
Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
Assignees []string `yaml:"assignees,omitempty" json:"assignees,omitempty"`
}
GitHubDependabotUpdateConfig represents a single package ecosystem update configuration
type GitProviderConfig ¶
type GitProviderConfig struct {
// Provider is the type of git provider (e.g., "github", "gitlab")
Provider string `yaml:"provider" json:"provider" mapstructure:"provider"`
// BaseURL is the base URL of the git provider (e.g., "https://github.com")
BaseURL string `yaml:"baseURL" json:"baseURL" mapstructure:"baseURL"`
// Token is the authentication token for the git provider
Token string `yaml:"token" json:"token" mapstructure:"token"`
}
type GoUpdaterConfig ¶
type GoUpdaterConfig struct {
// CommandOutputFile is the file path to output successful go get commands
// If empty, no output will be written
CommandOutputFile string `yaml:"commandOutputFile" json:"commandOutputFile" mapstructure:"commandOutputFile"`
}
GoUpdaterConfig contains Go-specific updater configuration
type HookConfig ¶
type HookConfig struct {
// Script contains the script content to execute
Script string `yaml:"script" json:"script" mapstructure:"script"`
// Timeout for script execution (e.g., "5m", "30s")
Timeout string `yaml:"timeout" json:"timeout" mapstructure:"timeout"`
// ContinueOnError determines whether to continue pipeline execution if script fails
ContinueOnError bool `yaml:"continueOnError" json:"continueOnError" mapstructure:"continueOnError"`
}
HookConfig contains configuration for a single pipeline hook
type HooksConfig ¶
type HooksConfig struct {
// PreScan contains script to execute before security scanning
PreScan *HookConfig `yaml:"preScan" json:"preScan" mapstructure:"preScan"`
// PostScan contains script to execute after security scanning
PostScan *HookConfig `yaml:"postScan" json:"postScan" mapstructure:"postScan"`
// PreCommit contains script to execute before committing changes
PreCommit *HookConfig `yaml:"preCommit" json:"preCommit" mapstructure:"preCommit"`
// PostCommit contains script to execute after committing changes
PostCommit *HookConfig `yaml:"postCommit" json:"postCommit" mapstructure:"postCommit"`
}
HooksConfig contains custom script configuration for pipeline hooks
type NoticeConfig ¶
type PRConfig ¶
type PRConfig struct {
AutoCreate *bool `yaml:"autoCreate" json:"autoCreate" mapstructure:"autoCreate"`
// PushBranch controls whether to push the branch to remote repository
PushBranch *bool `yaml:"pushBranch" json:"pushBranch" mapstructure:"pushBranch"`
// Labels are labels to add to the created PR
Labels []string `yaml:"labels" json:"labels" mapstructure:"labels"`
// Assignees are users to assign to the created PR
Assignees []string `yaml:"assignees" json:"assignees" mapstructure:"assignees"`
}
PRConfig contains pull request configuration
func (*PRConfig) NeedCreatePR ¶
func (*PRConfig) NeedPushBranch ¶
NeedPushBranch determines whether to push branch based on configuration If autocreate is true, push branch automatically becomes true
type PipelineScannerConfig ¶
type PipelineScannerConfig = ScannerConfig
PipelineScannerConfig represents scanner config for pipeline
type RepoConfig ¶
type RepoConfig struct {
// URL is the repository URL (e.g., "https://github.com/example/repo")
URL string `yaml:"url" json:"url" mapstructure:"url"`
// Branch is the repository branch (e.g., "main")
Branch string `yaml:"branch" json:"branch" mapstructure:"branch"`
// IncludeSubmodules indicates whether to clone submodules
IncludeSubmodules *bool `yaml:"includeSubmodules" json:"includeSubmodules" mapstructure:"includeSubmodules"`
}
func (*RepoConfig) GetIncludeSubmodules ¶
func (r *RepoConfig) GetIncludeSubmodules() bool
GetIncludeSubmodules returns the IncludeSubmodules value with default fallback
type ScannerConfig ¶
type ScannerConfig struct {
// Type specifies the scanner type (e.g., "trivy", "govulncheck")
Type string `yaml:"type" json:"type" mapstructure:"type"`
// Timeout for scanner execution (e.g., "5m")
Timeout string `yaml:"timeout" json:"timeout" mapstructure:"timeout"`
// Params contains scanner-specific parameters
Params []string `yaml:"params" json:"params" mapstructure:"params"`
}
ScannerConfig contains generic scanner configuration
type UpdaterConfig ¶
type UpdaterConfig struct {
// Go contains Go-specific updater configuration
Go *GoUpdaterConfig `yaml:"go" json:"go" mapstructure:"go"`
}
UpdaterConfig contains updater-specific configuration