From 0b4e8fc12508f9ac0d5a9f674d609eb505507c03 Mon Sep 17 00:00:00 2001 From: mrjoelkamp Date: Fri, 26 Jul 2024 09:44:12 -0500 Subject: [PATCH] fix: increase handler timeout --- main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index d399f55..61f9b25 100644 --- a/main.go +++ b/main.go @@ -17,7 +17,6 @@ import ( ) const ( - handlerTimeout = 15 * time.Second readHeaderTimeout = 1 * time.Second ) @@ -29,9 +28,10 @@ const ( ) var ( - certDir string - clientCAFile string - port int + certDir string + clientCAFile string + port int + handlerTimeoutSeconds int tufRoot string tufoutputPath string @@ -62,6 +62,7 @@ func init() { flag.StringVar(&certDir, "cert-dir", "", "path to directory containing TLS certificates") flag.StringVar(&clientCAFile, "client-ca-file", "", "path to client CA certificate") flag.IntVar(&port, "port", defaultPort, "Port for the server to listen on") + flag.IntVar(&handlerTimeoutSeconds, "handler-timeout", 25, "timeout for handler in seconds") flag.StringVar(&tufRoot, "tuf-root", "prod", "specify embedded tuf root [dev, staging, prod], default [prod]") flag.StringVar(&metadataURL, "tuf-metadata-source", defaultMetadataURL, "source (URL or repo) for TUF metadata") @@ -79,6 +80,7 @@ func init() { func main() { mux := http.NewServeMux() + handlerTimeout := time.Duration(handlerTimeoutSeconds) * time.Second validateHandler, err := handler.NewValidateHandler(&handler.ValidateHandlerOptions{ TUFRoot: tufRoot,