Skip to content

Commit 2bdd74b

Browse files
committed
chore: use separate profiler flag
1 parent 6786a9c commit 2bdd74b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

api.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,16 @@ func Serve() {
8484

8585
migrations.RunMigrations(ctx)
8686

87-
if !viper.GetBool("production") {
87+
if viper.GetBool("profiler") {
8888
go func() {
8989
debugServer := echo.New()
9090
pprof.Register(debugServer)
9191
debugServer.Any("/debug/fgprof", echo.WrapHandler(fgprof.Handler()))
92-
debugServer.Logger.Fatal(debugServer.Start(":6060"))
92+
debugServer.HideBanner = true
93+
debugServer.HidePort = true
94+
address := ":6060"
95+
log.Info().Str("address", address).Msg("starting profiler")
96+
debugServer.Logger.Fatal(debugServer.Start(address))
9397
}()
9498
}
9599

config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func initializeDefaults() {
4646
viper.SetDefault("port", "5020")
4747

4848
viper.SetDefault("production", true)
49+
viper.SetDefault("profiler", false)
4950

5051
viper.SetDefault("database.redis.host", "localhost")
5152
viper.SetDefault("database.redis.port", 6379)

0 commit comments

Comments
 (0)