Skip to content

Commit 5addb02

Browse files
committed
feat: allow changing pprof port and host in .env
1 parent 78f47a8 commit 5addb02

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ INFLUXDB_URL=http://localhost:8086
77
INFLUXDB_TOKEN=token
88
INFLUXDB_ORG=minetracker
99
INFLUXDB_BUCKET=minetracker_data
10+
11+
PROFILING_ENABLED=true
12+
PROFILING_PORT=6060
13+
PROFILING_HOST=localhost

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ func main() {
118118

119119
if os.Getenv("PROFILING_ENABLED") == "true" {
120120
go func() {
121-
util.Logger.Info().Msg("pprof listening on :6060")
122-
if err := http.ListenAndServe("localhost:6060", nil); err != nil {
121+
util.Logger.Info().Msg("pprof listening on :" + os.Getenv("PROFILING_PORT"))
122+
if err := http.ListenAndServe(os.Getenv("PROFILING_HOST")+":"+os.Getenv("PROFILING_PORT"), nil); err != nil {
123123
util.Logger.Error().Err(err).Msg("pprof server failed")
124124
}
125125
}()

0 commit comments

Comments
 (0)