mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
Adding baseurl flag to allow self-hosted GitLab/GitHub servers
This commit is contained in:
1 parent
ef38b69c39
commit
c5e1e8abc0
3 files changed
+25
-2
No files matched your search
+14
-1
@@ -33,9 +33,22 @@ func NewGithubClient(m manager.Manager) *Github {
|
||||
&oauth2.Token{AccessToken: options.GetAccessToken(m.Opts)},
|
||||
)
|
||||
|
||||
var githubClient *github.Client
|
||||
httpClient := oauth2.NewClient(ctx, token)
|
||||
|
||||
if m.Opts.BaseURL == "" {
|
||||
githubClient = github.NewClient(httpClient)
|
||||
} else {
|
||||
var err error
|
||||
githubClient, err = github.NewEnterpriseClient(m.Opts.BaseURL, m.Opts.BaseURL, httpClient)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
return &Github{
|
||||
manager: m,
|
||||
client: github.NewClient(oauth2.NewClient(ctx, token)),
|
||||
client: githubClient,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user