Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add signal handling and resource cleanup #97

Merged
merged 1 commit into from
May 13, 2024
Merged

Conversation

mhrabovcin
Copy link
Owner

No description provided.

@mhrabovcin mhrabovcin self-assigned this May 13, 2024
cmd/serve.go Outdated
go func() {
<-ctx.Done()
out.Info("Shutting down troubleshoot-live...")
s.Shutdown(ctx)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
Error return value of s.Shutdown is not checked (errcheck)

cmd/serve.go Outdated
@@ -113,8 +117,20 @@ func runServe(bundlePath string, o *serveOptions, out output.Output) error {
proxyHandler := proxy.New(testEnv.Config, supportBundle, rewriter.Default())
loggedProxyHandler := handlers.LoggingHandler(out.InfoWriter(), proxyHandler)

http.Handle("/", loggedProxyHandler)
return http.ListenAndServe(o.proxyAddress, nil) //nolint:gosec // not a production server
s := http.Server{Addr: o.proxyAddress, Handler: loggedProxyHandler}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec)

@mhrabovcin mhrabovcin force-pushed the cleanup-resources branch from 91222d2 to fd3fa6f Compare May 13, 2024 09:09
@mhrabovcin mhrabovcin merged commit b033b9d into main May 13, 2024
3 checks passed
@mhrabovcin mhrabovcin deleted the cleanup-resources branch May 13, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant