use switch case

This commit is contained in:
Matti Ranta 2019-04-22 19:36:47 -04:00
parent 9ced52ab50
commit b7fc433b31
No known key found for this signature in database
GPG key ID: D9B5613BEB813F99

View file

@ -164,15 +164,15 @@ func provideStashLogin(config config.Config) login.Middleware {
// provideRefresher is a Wire provider function that returns
// an oauth token refresher for Bitbucket.
func provideRefresher(config config.Config) *oauth2.Refresher {
if config.Bitbucket.ClientID != "" {
switch {
case config.Bitbucket.ClientID != "":
return &oauth2.Refresher{
ClientID: config.Bitbucket.ClientID,
ClientSecret: config.Bitbucket.ClientSecret,
Endpoint: "https://bitbucket.org/site/oauth2/access_token",
Source: oauth2.ContextTokenSource(),
}
}
if config.Gitea.ClientID != "" {
case config.Gitea.Server != "":
return &oauth2.Refresher{
ClientID: config.Gitea.ClientID,
ClientSecret: config.Gitea.ClientSecret,