Skip to content

Find, verify, and analyze leaked credentials

Disable profiler in debug mode and add profile switch (#1136)

Yassine Ilmi0cf9139df688
diff --git a/README.md b/README.md
index e8b3210f3..01786f531 100644
--- a/README.md
+++ b/README.md
@@ -190,6 +190,7 @@ Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
--debug Run in debug mode.
--trace Run in trace mode.
+ --profile Enables profiling and sets a pprof and fgprof server on :18066.
-j, --json Output in JSON format.
--json-legacy Use the pre-v3.0 JSON format. Only works with git, gitlab, and github sources.
--concurrency=10 Number of concurrent workers.
diff --git a/main.go b/main.go
index 13424f239..49707b946 100644
--- a/main.go
+++ b/main.go
@@ -38,6 +38,7 @@ var (
cmd string
debug = cli.Flag("debug", "Run in debug mode.").Bool()
trace = cli.Flag("trace", "Run in trace mode.").Bool()
+ profile = cli.Flag("profile", "Enables profiling and sets a pprof and fgprof server on :18066.").Bool()
jsonOut = cli.Flag("json", "Output in JSON format.").Short('j').Bool()
jsonLegacy = cli.Flag("json-legacy", "Use the pre-v3.0 JSON format. Only works with git, gitlab, and github sources.").Bool()
concurrency = cli.Flag("concurrency", "Number of concurrent workers.").Default(strconv.Itoa(runtime.NumCPU())).Int()
@@ -183,7 +184,7 @@ func run(state overseer.State) {
*concurrency = 1
}
- if *debug {
+ if *profile {
go func() {
router := mux.NewRouter()
router.PathPrefix("/debug/pprof").Handler(http.DefaultServeMux)