Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidScheme is returned when GitLab URL doesn't use HTTPS. ErrInvalidScheme = errors.New("GITLAB_URL must use https scheme") // ErrConfig is returned when configuration is invalid. ErrConfig = errors.New("invalid OAuth configuration") // ErrFlagNotFound is returned when a flag is not found. ErrFlagNotFound = errors.New("flag not found") )
Functions ¶
func DefaultBaseURL ¶ added in v1.22.2
func DefaultBaseURL() string
DefaultBaseURL returns the default GitLab URL or the URL specified by the GITLAB_URL environment variable.
Types ¶
type BaseURLFlag ¶ added in v1.22.2
BaseURLFlag wraps a string to implement the `pflag.Value` interface. This type provides an implementation to customize the behavior of `--base-url` in the `cobra.Command` command-line interface.
func (*BaseURLFlag) Set ¶ added in v1.22.2
func (f *BaseURLFlag) Set(s string) error
Set sets the value of the flag. The value is sanitized by removing any trailing slashes and the `/api/v4` path from the end of the string. If the string is empty, it is set to the default base URL.
func (*BaseURLFlag) String ¶ added in v1.22.2
func (f *BaseURLFlag) String() string
func (*BaseURLFlag) Type ¶ added in v1.22.2
func (*BaseURLFlag) Type() string
type Config ¶
type Config struct { AuthSource gitlab.AuthSource BaseURL string // Optional ClientID string AuthOAuth bool AuthPAT bool }
func ConfigFromFlags ¶ added in v1.23.0
ConfigFromFlags creates a new configuration by based on the provided flag set. GitLab tokens are determined from the environment or file system.
func ConfigFromRequest ¶ added in v1.23.0
func ConfigFromRequest(r *http.Request, serverConfig ServerConfig) (*Config, error)
ConfigFromRequest reads configuration from an HTTP request. It looks for the 'Private-Token' headers to set the access token.
type ServerConfig ¶ added in v1.23.0
ServerConfig represents the server-side configuration.