use switch case
This commit is contained in:
parent
9ced52ab50
commit
b7fc433b31
1 changed files with 3 additions and 3 deletions
|
@ -164,15 +164,15 @@ func provideStashLogin(config config.Config) login.Middleware {
|
||||||
// provideRefresher is a Wire provider function that returns
|
// provideRefresher is a Wire provider function that returns
|
||||||
// an oauth token refresher for Bitbucket.
|
// an oauth token refresher for Bitbucket.
|
||||||
func provideRefresher(config config.Config) *oauth2.Refresher {
|
func provideRefresher(config config.Config) *oauth2.Refresher {
|
||||||
if config.Bitbucket.ClientID != "" {
|
switch {
|
||||||
|
case config.Bitbucket.ClientID != "":
|
||||||
return &oauth2.Refresher{
|
return &oauth2.Refresher{
|
||||||
ClientID: config.Bitbucket.ClientID,
|
ClientID: config.Bitbucket.ClientID,
|
||||||
ClientSecret: config.Bitbucket.ClientSecret,
|
ClientSecret: config.Bitbucket.ClientSecret,
|
||||||
Endpoint: "https://bitbucket.org/site/oauth2/access_token",
|
Endpoint: "https://bitbucket.org/site/oauth2/access_token",
|
||||||
Source: oauth2.ContextTokenSource(),
|
Source: oauth2.ContextTokenSource(),
|
||||||
}
|
}
|
||||||
}
|
case config.Gitea.Server != "":
|
||||||
if config.Gitea.ClientID != "" {
|
|
||||||
return &oauth2.Refresher{
|
return &oauth2.Refresher{
|
||||||
ClientID: config.Gitea.ClientID,
|
ClientID: config.Gitea.ClientID,
|
||||||
ClientSecret: config.Gitea.ClientSecret,
|
ClientSecret: config.Gitea.ClientSecret,
|
||||||
|
|
Loading…
Reference in a new issue