You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-29 21:48:14 +02:00
Cleanup server env settings (#3670)
Co-authored-by: Robert Kaussow <mail@thegeeklab.de> Co-authored-by: Robert Kaussow <xoxys@rknet.org>
This commit is contained in:
@@ -51,6 +51,7 @@ type Opts struct {
|
||||
ClientID string // Oauth2 client id.
|
||||
ClientSecret string // Oauth2 client secret.
|
||||
SkipVerify bool // Skip ssl verification.
|
||||
OAuthHost string // Public url for oauth if different from url.
|
||||
}
|
||||
|
||||
// Gitlab implements "Forge" interface.
|
||||
@@ -61,6 +62,7 @@ type GitLab struct {
|
||||
SkipVerify bool
|
||||
HideArchives bool
|
||||
Search bool
|
||||
oAuthHost string
|
||||
}
|
||||
|
||||
// New returns a Forge implementation that integrates with Gitlab, an open
|
||||
@@ -70,6 +72,7 @@ func New(opts Opts) (forge.Forge, error) {
|
||||
url: opts.URL,
|
||||
ClientID: opts.ClientID,
|
||||
ClientSecret: opts.ClientSecret,
|
||||
oAuthHost: opts.OAuthHost,
|
||||
SkipVerify: opts.SkipVerify,
|
||||
HideArchives: true,
|
||||
}, nil
|
||||
@@ -86,11 +89,16 @@ func (g *GitLab) URL() string {
|
||||
}
|
||||
|
||||
func (g *GitLab) oauth2Config(ctx context.Context) (*oauth2.Config, context.Context) {
|
||||
publicOAuthURL := g.oAuthHost
|
||||
if publicOAuthURL == "" {
|
||||
publicOAuthURL = g.url
|
||||
}
|
||||
|
||||
return &oauth2.Config{
|
||||
ClientID: g.ClientID,
|
||||
ClientSecret: g.ClientSecret,
|
||||
Endpoint: oauth2.Endpoint{
|
||||
AuthURL: fmt.Sprintf("%s/oauth/authorize", g.url),
|
||||
AuthURL: fmt.Sprintf("%s/oauth/authorize", publicOAuthURL),
|
||||
TokenURL: fmt.Sprintf("%s/oauth/token", g.url),
|
||||
},
|
||||
Scopes: []string{defaultScope},
|
||||
|
||||
Reference in New Issue
Block a user