Git returns a Provider for this config if the provider type is a supported git hosting provider. Returns (nil, nil) for non-git providers (e.g. Slack, JFrog). Returns a non-nil error if provider construction fails.
(client *http.Client)
| 148 | // providers (e.g. Slack, JFrog). Returns a non-nil error if provider |
| 149 | // construction fails. |
| 150 | func (c *Config) Git(client *http.Client) (gitprovider.Provider, error) { |
| 151 | norm := strings.ToLower(c.Type) |
| 152 | if !codersdk.EnhancedExternalAuthProvider(norm).Git() { |
| 153 | return nil, nil //nolint:nilnil // nil provider means non-git type, not an error |
| 154 | } |
| 155 | return gitprovider.New(norm, c.APIBaseURL, client) |
| 156 | } |
| 157 | |
| 158 | // GenerateTokenExtra generates the extra token data to store in the database. |
| 159 | func (c *Config) GenerateTokenExtra(token *oauth2.Token) (pqtype.NullRawMessage, error) { |
no test coverage detected