Sfoglia il codice sorgente

Reset config at the start of config.Configure()

DarthSim 1 anno fa
parent
commit
13d311fd1a
2 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. 2 0
      config/config.go
  2. 2 3
      processing_handler_test.go

+ 2 - 0
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)
 	}

+ 2 - 3
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)