Skip to content

Commit

Permalink
Account for nil values in OAuth configuration (#4510)
Browse files Browse the repository at this point in the history
A recent change ended up initializing them. This ensure that we deal
with these initialized values.

Signed-off-by: Juan Antonio Osorio <[email protected]>
  • Loading branch information
JAORMX authored Sep 17, 2024
1 parent dc1b896 commit 6f89a1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/providers/github/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func (g *githubProviderManager) NewOAuthConfig(providerClass db.ProviderClass, c
}

// this is currently only used for testing as github uses well-known endpoints
if oauthClientConfig.Endpoint != nil {
if oauthClientConfig.Endpoint != nil && oauthClientConfig.Endpoint.TokenURL != "" {
oauthConfig.Endpoint = oauth2.Endpoint{
TokenURL: oauthClientConfig.Endpoint.TokenURL,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/providers/gitlab/manager/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (g *providerClassManager) NewOAuthConfig(_ db.ProviderClass, cli bool) (*oa
}

// this is currently only used for testing as github uses well-known endpoints
if oauthClientConfig.Endpoint != nil {
if oauthClientConfig.Endpoint != nil && oauthClientConfig.Endpoint.TokenURL != "" {
oauthConfig.Endpoint = oauth2.Endpoint{
TokenURL: oauthClientConfig.Endpoint.TokenURL,
}
Expand Down

0 comments on commit 6f89a1d

Please sign in to comment.