use embed pkg for default config, update deps (#616)

This commit is contained in:
Zachary Rice authored and GitHub committed 2021-09-02 14:42:14 -05:00
1 parent 3c1751e5c4
commit abc73e2443
4 files changed
+64 -52

No files matched your search

+5 -1
View File
@@ -1,6 +1,7 @@
package config
import (
_ "embed"
"fmt"
"io"
"os"
@@ -16,6 +17,9 @@ import (
log "github.com/sirupsen/logrus"
)
//go:embed gitleaks.toml
var DefaultConfig string
// Config is a composite struct of Rules and Allowlists
// Each Rule contains a description, regular expression, tags, and allowlists if available
type Config struct {
@@ -42,7 +46,7 @@ type TomlAllowList struct {
}
// TomlLoader gets loaded with the values from a gitleaks toml config
// see the config in config/defaults.go for an example. TomlLoader is used
// see the config in config/gitleaks.toml for an example. TomlLoader is used
// to generate Config values (compiling regexes, etc).
type TomlLoader struct {
AllowList TomlAllowList
@@ -1,9 +1,4 @@
package config
// DefaultConfig is the default gitleaks configuration. If --config={path-to-config} is set than the config located
// at {path-to-config} will be used. Alternatively, if --repo-config is set then gitleaks will attempt to
// use the config set in a gitleaks.toml or .gitleaks.toml file in the repo that is run with --repo-config set.
const DefaultConfig = `
title = "gitleaks config"
[[rules]]
@@ -178,4 +173,3 @@ title = "gitleaks config"
files = ['''^\.?gitleaks.toml$''',
'''(.*?)(png|jpg|gif|doc|docx|pdf|bin|xls|pyc|zip)$''',
'''(go.mod|go.sum)$''']
`