From 13d311fd1ae8a01aed9879c17ef32b267d5b182a Mon Sep 17 00:00:00 2001 From: DarthSim Date: Tue, 30 Apr 2024 16:51:02 +0300 Subject: [PATCH] Reset config at the start of config.Configure() --- config/config.go | 2 ++ processing_handler_test.go | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/config.go b/config/config.go index ea3f0d5b..ec37a53e 100644 --- a/config/config.go +++ b/config/config.go @@ -389,6 +389,8 @@ func Reset() { } func Configure() error { + Reset() + if port := os.Getenv("PORT"); len(port) > 0 { Bind = fmt.Sprintf(":%s", port) } diff --git a/processing_handler_test.go b/processing_handler_test.go index 0a4cb0f3..1e8acba6 100644 --- a/processing_handler_test.go +++ b/processing_handler_test.go @@ -40,9 +40,8 @@ func (s *ProcessingHandlerTestSuite) SetupSuite() { wd, err := os.Getwd() s.Require().NoError(err) - config.LocalFileSystemRoot = filepath.Join(wd, "/testdata") - // Disable keep-alive to test connection restrictions - config.ClientKeepAliveTimeout = 0 + s.T().Setenv("IMGPROXY_LOCAL_FILESYSTEM_ROOT", filepath.Join(wd, "/testdata")) + s.T().Setenv("IMGPROXY_CLIENT_KEEP_ALIVE_TIMEOUT", "0") err = initialize() s.Require().NoError(err)