From 50a8b39ea350dad933a6fe1f1a3a3e7ed47886d0 Mon Sep 17 00:00:00 2001 From: mleku Date: Tue, 28 Oct 2025 13:32:30 +0000 Subject: [PATCH] fix broken pprof web by removing for now --- app/config/config.go | 1 - main.go | 43 ------------------------------------------- 2 files changed, 44 deletions(-) diff --git a/app/config/config.go b/app/config/config.go index 3df3d9f..191975c 100644 --- a/app/config/config.go +++ b/app/config/config.go @@ -37,7 +37,6 @@ type C struct { Pprof string `env:"ORLY_PPROF" usage:"enable pprof in modes: cpu,memory,allocation,heap,block,goroutine,threadcreate,mutex"` PprofPath string `env:"ORLY_PPROF_PATH" usage:"optional directory to write pprof profiles into (inside container); default is temporary dir"` PprofHTTP bool `env:"ORLY_PPROF_HTTP" default:"false" usage:"if true, expose net/http/pprof on port 6060"` - OpenPprofWeb bool `env:"ORLY_OPEN_PPROF_WEB" default:"false" usage:"if true, automatically open the pprof web viewer when profiling is enabled"` IPWhitelist []string `env:"ORLY_IP_WHITELIST" usage:"comma-separated list of IP addresses to allow access from, matches on prefixes to allow private subnets, eg 10.0.0 = 10.0.0.0/8"` IPBlacklist []string `env:"ORLY_IP_BLACKLIST" usage:"comma-separated list of IP addresses to block; matches on prefixes to allow subnets, e.g. 192.168 = 192.168.0.0/16"` Admins []string `env:"ORLY_ADMINS" usage:"comma-separated list of admin npubs"` diff --git a/main.go b/main.go index d795f8d..408b761 100644 --- a/main.go +++ b/main.go @@ -6,9 +6,7 @@ import ( "net/http" pp "net/http/pprof" "os" - "os/exec" "os/signal" - "runtime" "sync" "syscall" "time" @@ -26,33 +24,7 @@ import ( "next.orly.dev/pkg/version" ) -// openBrowser attempts to open the specified URL in the default browser. -// It supports multiple platforms including Linux, macOS, and Windows. -func openBrowser(url string) { - var err error - switch runtime.GOOS { - case "linux": - err = exec.Command("xdg-open", url).Start() - case "windows": - err = exec.Command( - "rundll32", "url.dll,FileProtocolHandler", url, - ).Start() - case "darwin": - err = exec.Command("open", url).Start() - default: - log.W.F("unsupported platform for opening browser: %s", runtime.GOOS) - return - } - - if err != nil { - log.E.F("failed to open browser: %v", err) - } else { - log.I.F("opened browser to %s", url) - } -} - func main() { - runtime.GOMAXPROCS(runtime.NumCPU() * 4) var err error var cfg *config.C if cfg, err = config.New(); chk.T(err) { @@ -80,11 +52,6 @@ func main() { os.Exit(0) } - // If OpenPprofWeb is true and profiling is enabled, we need to ensure HTTP profiling is also enabled - if cfg.OpenPprofWeb && cfg.Pprof != "" && !cfg.PprofHTTP { - log.I.F("enabling HTTP pprof server to support web viewer") - cfg.PprofHTTP = true - } // Ensure profiling is stopped on interrupts (SIGINT/SIGTERM) as well as on normal exit var profileStopOnce sync.Once profileStop := func() {} @@ -318,16 +285,6 @@ func main() { defer cancelShutdown() _ = ppSrv.Shutdown(shutdownCtx) }() - - // Open the pprof web viewer if enabled - if cfg.OpenPprofWeb && cfg.Pprof != "" { - pprofURL := "http://localhost:6060/debug/pprof/" - go func() { - // Wait a moment for the server to start - time.Sleep(500 * time.Millisecond) - openBrowser(pprofURL) - }() - } } // Start health check HTTP server if configured