Skip to content

Commit

Permalink
Change env handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pappz committed Nov 29, 2024
1 parent 81df855 commit 0011e65
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions client/cmd/pprof.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//go:build pprof
// +build pprof

package cmd

Expand All @@ -11,20 +12,17 @@ import (
)

func init() {
if addr, ok := isPprofAddr(); ok {
go pprof(addr)
} else {
go pprof("localhost:6969")
}
addr := pprofAddr()
go pprof(addr)
}

func isPprofAddr() (string, bool) {
func pprofAddr() string {
listenAddr := os.Getenv("NB_PPROF_ADDR")
if listenAddr == "" {
return "", false
return "localhost:6969"
}

return listenAddr, true
return listenAddr
}

func pprof(listenAddr string) {
Expand Down

0 comments on commit 0011e65

Please sign in to comment.