Documentation
¶
Overview ¶
Package config provides configuration loading for gitlab-duo-acp. Configuration can be provided via a YAML file and/or environment variables, with environment variables taking precedence.
Index ¶
Constants ¶
View Source
const ( // DefaultConfigPath is the default location for the config file. DefaultConfigPath = "~/.config/gitlab-duo-acp/config.yml" // DefaultGitLabURL is the default GitLab instance URL. DefaultGitLabURL = "https://gitlab.com" // EnvGitLabURL is the environment variable for GitLab URL. EnvGitLabURL = "GITLAB_URL" // EnvGitLabAuthToken is the environment variable for GitLab auth token. EnvGitLabAuthToken = "GITLAB_AUTH_TOKEN" //nolint:gosec // G101: not a credential, just an env var name )
Variables ¶
View Source
var ( // ErrMissingGitLabURL is returned when gitlab_url is not configured. ErrMissingGitLabURL = errors.New("gitlab_url is required") // ErrMissingAuthToken is returned when gitlab_auth_token is not configured. ErrMissingAuthToken = errors.New("gitlab_auth_token is required") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// GitLabURL is the URL of the GitLab instance.
GitLabURL string `yaml:"gitlab_url"`
// GitLabAuthToken is the authentication token for GitLab API.
GitLabAuthToken string `yaml:"gitlab_auth_token"`
}
Config holds the configuration for gitlab-duo-acp.
type Loader ¶
type Loader struct {
// GetEnv is the function used to look up environment variables.
// Defaults to os.Getenv if nil.
GetEnv EnvFunc
// ReadFile is the function used to read files.
// Defaults to os.ReadFile if nil.
ReadFile func(string) ([]byte, error)
// UserHomeDir is the function used to get the user's home directory.
// Defaults to os.UserHomeDir if nil.
UserHomeDir func() (string, error)
}
Loader handles configuration loading with injectable dependencies.
func DefaultLoader ¶
func DefaultLoader() *Loader
DefaultLoader returns a Loader with default OS functions.
Click to show internal directories.
Click to hide internal directories.