NewOAuthButtons creates a new OAuthButtons struct based on our app configuration.
(cfg *config.Config)
| 41 | |
| 42 | // NewOAuthButtons creates a new OAuthButtons struct based on our app configuration. |
| 43 | func NewOAuthButtons(cfg *config.Config) *OAuthButtons { |
| 44 | return &OAuthButtons{ |
| 45 | SlackEnabled: cfg.SlackOauth.ClientID != "", |
| 46 | WriteAsEnabled: cfg.WriteAsOauth.ClientID != "", |
| 47 | GitLabEnabled: cfg.GitlabOauth.ClientID != "", |
| 48 | GitLabDisplayName: config.OrDefaultString(cfg.GitlabOauth.DisplayName, gitlabDisplayName), |
| 49 | GiteaEnabled: cfg.GiteaOauth.ClientID != "", |
| 50 | GiteaDisplayName: config.OrDefaultString(cfg.GiteaOauth.DisplayName, giteaDisplayName), |
| 51 | GenericEnabled: cfg.GenericOauth.ClientID != "", |
| 52 | GenericDisplayName: config.OrDefaultString(cfg.GenericOauth.DisplayName, genericOauthDisplayName), |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // TokenResponse contains data returned when a token is created either |
| 57 | // through a code exchange or using a refresh token. |
no test coverage detected