mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 05:04:22 +01:00
v3 work... lots of things
This commit is contained in:
1 parent
f3360cbf66
commit
b55d88dc15
215 files changed
+5513
-4218
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package hosts
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks-ng/manager"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
_github int = iota + 1
|
||||
_gitlab
|
||||
)
|
||||
|
||||
type Host interface {
|
||||
Audit()
|
||||
AuditPR()
|
||||
}
|
||||
|
||||
func Run(m *manager.Manager) error {
|
||||
var host Host
|
||||
switch getHost(m.Opts.Host) {
|
||||
case _github:
|
||||
host = NewGithubClient(*m)
|
||||
case _gitlab:
|
||||
host = NewGitlabClient(*m)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.Opts.PullRequest != "" {
|
||||
host.AuditPR()
|
||||
} else {
|
||||
host.Audit()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func getHost(host string) int {
|
||||
if strings.ToLower(host) == "github" {
|
||||
return _github
|
||||
} else if strings.ToLower(host) == "gitlab" {
|
||||
return _gitlab
|
||||
}
|
||||
return -1
|
||||
}
|
||||
Reference in new issue
Block a user