diff --git a/internal/http/http.go b/internal/http/http.go index e3ae9978..b3e1521a 100644 --- a/internal/http/http.go +++ b/internal/http/http.go @@ -40,7 +40,6 @@ func Run( history History, redisConnection *redis.Redis, saveIntercal time.Duration, - profileRoutes bool, ) error { var connectionCount *connectionCount if redisConnection != nil { @@ -54,10 +53,7 @@ func Run( HandleInternalAutoupdate(mux, auth, history, autoupdate) HandleShowConnectionCount(mux, autoupdate, auth, connectionCount) HandleHistoryInformation(mux, auth, history) - - if profileRoutes { - HandleProfile(mux) - } + HandleProfile(mux) srv := &http.Server{ Addr: addr, @@ -358,12 +354,12 @@ func HandleHealth(mux *http.ServeMux) { // HandleProfile adds routes for profiling. func HandleProfile(mux *http.ServeMux) { - mux.Handle(prefixPublic+"/debug/pprof/", http.HandlerFunc(pprof.Index)) - mux.Handle(prefixPublic+"/debug/pprof/heap", pprof.Handler("heap")) - mux.Handle(prefixPublic+"/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline)) - mux.Handle(prefixPublic+"/debug/pprof/profile", http.HandlerFunc(pprof.Profile)) - mux.Handle(prefixPublic+"/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol)) - mux.Handle(prefixPublic+"/debug/pprof/trace", http.HandlerFunc(pprof.Trace)) + mux.Handle(prefixInternal+"/debug/pprof/", http.HandlerFunc(pprof.Index)) + mux.Handle(prefixInternal+"/debug/pprof/heap", pprof.Handler("heap")) + mux.Handle(prefixInternal+"/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline)) + mux.Handle(prefixInternal+"/debug/pprof/profile", http.HandlerFunc(pprof.Profile)) + mux.Handle(prefixInternal+"/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol)) + mux.Handle(prefixInternal+"/debug/pprof/trace", http.HandlerFunc(pprof.Trace)) } func authMiddleware(next http.Handler, auth Authenticater) http.Handler { diff --git a/main.go b/main.go index fca268c3..6163cb0b 100644 --- a/main.go +++ b/main.go @@ -29,7 +29,6 @@ var ( envMetricInterval = environment.NewVariable("METRIC_INTERVAL", "5m", "Time in how often the metrics are gathered. Zero disables the metrics.") envMetricSaveInterval = environment.NewVariable("METRIC_SAVE_INTERVAL", "5m", "Interval, how often the metric should be saved to redis. Redis will ignore entries, that are twice at old then the save interval.") envDisableConnectionCount = environment.NewVariable("DISABLE_CONNECTION_COUNT", "false", "Do not count connections.") - envEnableProfileRoutes = environment.NewVariable("ENABLE_PROFILE_ROUTES", "false", "Activate development routes for profiling.") ) var cli struct { @@ -185,8 +184,6 @@ func initService(lookup environment.Environmenter) (func(context.Context) error, metricStorage = nil } - profileRoutes, _ := strconv.ParseBool(envEnableProfileRoutes.Value(lookup)) - service := func(ctx context.Context) error { for _, bg := range backgroundTasks { go bg(ctx, oserror.Handle) @@ -194,7 +191,7 @@ func initService(lookup environment.Environmenter) (func(context.Context) error, // Start http server. fmt.Printf("Listen on %s\n", listenAddr) - return http.Run(ctx, listenAddr, authService, auService, historyService, metricStorage, metricSaveInterval, profileRoutes) + return http.Run(ctx, listenAddr, authService, auService, historyService, metricStorage, metricSaveInterval) } return service, nil