Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.go16
-rw-r--r--internal/config/config.go5
-rw-r--r--internal/serving/disk/zip/serving.go2
-rw-r--r--internal/serving/disk/zip/serving_test.go15
4 files changed, 21 insertions, 17 deletions
diff --git a/app.go b/app.go
index ccd107fb..c411470b 100644
--- a/app.go
+++ b/app.go
@@ -506,12 +506,18 @@ func runApp(config appConfig) {
log.WithError(err).Warn("Loading extended MIME database failed")
}
- cfg.Default.Zip.ExpirationInterval = config.ZipCacheExpiry
- cfg.Default.Zip.CleanupInterval = config.ZipCacheCleanup
- cfg.Default.Zip.RefreshInterval = config.ZipCacheRefresh
- cfg.Default.Zip.OpenTimeout = config.ZipeOpenTimeout
+ c := &cfg.Config{
+ Zip: &cfg.ZipServing{
+ ExpirationInterval: config.ZipCacheExpiry,
+ CleanupInterval: config.ZipCacheCleanup,
+ RefreshInterval: config.ZipCacheRefresh,
+ OpenTimeout: config.ZipeOpenTimeout,
+ },
+ }
- if err := zip.Instance().Reconfigure(cfg.Default); err != nil {
+ // TODO: reconfigure all VFS'
+ // https://gitlab.com/gitlab-org/gitlab-pages/-/issues/512
+ if err := zip.Instance().Reconfigure(c); err != nil {
fatal(err, "failed to reconfigure zip VFS")
}
diff --git a/internal/config/config.go b/internal/config/config.go
index 66f1a2b9..c52beef8 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -4,11 +4,6 @@ import (
"time"
)
-// Default configuration that can be accessed by different packages
-var Default = &Config{
- Zip: &ZipServing{},
-}
-
type Config struct {
Zip *ZipServing
}
diff --git a/internal/serving/disk/zip/serving.go b/internal/serving/disk/zip/serving.go
index 6d21f771..6db0be10 100644
--- a/internal/serving/disk/zip/serving.go
+++ b/internal/serving/disk/zip/serving.go
@@ -8,7 +8,7 @@ import (
"gitlab.com/gitlab-org/gitlab-pages/internal/vfs/zip"
)
-var instance = disk.New(vfs.Instrumented(zip.New(config.Default.Zip)))
+var instance = disk.New(vfs.Instrumented(zip.New(&config.ZipServing{})))
// Instance returns a serving instance that is capable of reading files
// from a zip archives opened from a URL, most likely stored in object storage
diff --git a/internal/serving/disk/zip/serving_test.go b/internal/serving/disk/zip/serving_test.go
index 40b8e02a..e64a761a 100644
--- a/internal/serving/disk/zip/serving_test.go
+++ b/internal/serving/disk/zip/serving_test.go
@@ -55,14 +55,17 @@ func TestZip_ServeFileHTTP(t *testing.T) {
},
}
- config.Default.Zip = &config.ZipServing{
- ExpirationInterval: 10 * time.Second,
- CleanupInterval: 5 * time.Second,
- RefreshInterval: 5 * time.Second,
- OpenTimeout: 5 * time.Second,
+ cfg := &config.Config{
+ Zip: &config.ZipServing{
+ ExpirationInterval: 10 * time.Second,
+ CleanupInterval: 5 * time.Second,
+ RefreshInterval: 5 * time.Second,
+ OpenTimeout: 5 * time.Second,
+ },
}
+
s := Instance()
- err := s.Reconfigure(config.Default)
+ err := s.Reconfigure(cfg)
require.NoError(t, err)
for name, test := range tests {