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:
authorJaime Martinez <jmartinez@gitlab.com>2022-03-16 01:17:48 +0300
committerJaime Martinez <jmartinez@gitlab.com>2022-03-16 01:17:48 +0300
commit7f9950f17e2a9e5bd55878d5a7fbf9db6ad29cfb (patch)
treeae1ba64ca515d2286f8df6967450dd2d792acebe
parentf6ada25223c6f9b531a1e30da576ee042b361c2e (diff)
parent6bde1a533714448e6657cf393151a231db496436 (diff)
Merge branch 'feature/zip-http-timeout-param' into 'master'
add flag to parameterize zip http client timeout See merge request gitlab-org/gitlab-pages!710
-rw-r--r--internal/config/config.go3
-rw-r--r--internal/config/flags.go29
-rw-r--r--internal/vfs/zip/vfs.go4
3 files changed, 19 insertions, 17 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 7644e5ad..48bab76e 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -135,6 +135,7 @@ type ZipServing struct {
RefreshInterval time.Duration
OpenTimeout time.Duration
AllowedPaths []string
+ HTTPClientTimeout time.Duration
}
func internalGitlabServerFromFlags() string {
@@ -240,6 +241,7 @@ func loadConfig() (*Config, error) {
RefreshInterval: *zipCacheRefresh,
OpenTimeout: *zipOpenTimeout,
AllowedPaths: []string{*pagesRoot},
+ HTTPClientTimeout: *zipHTTPClientTimeout,
},
// Actual listener pointers will be populated in appMain. We populate the
@@ -315,6 +317,7 @@ func LogConfig(config *Config) {
"zip-cache-cleanup": config.Zip.CleanupInterval,
"zip-cache-refresh": config.Zip.RefreshInterval,
"zip-open-timeout": config.Zip.OpenTimeout,
+ "zip-http-client-timeout": config.Zip.HTTPClientTimeout,
"rate-limit-source-ip": config.RateLimit.SourceIPLimitPerSecond,
"rate-limit-source-ip-burst": config.RateLimit.SourceIPBurst,
"rate-limit-domain": config.RateLimit.DomainLimitPerSecond,
diff --git a/internal/config/flags.go b/internal/config/flags.go
index 091e07e3..cd44692a 100644
--- a/internal/config/flags.go
+++ b/internal/config/flags.go
@@ -66,20 +66,21 @@ var (
_ = flag.String("domain-config-source", "gitlab", "DEPRECATED and has not affect, see https://gitlab.com/gitlab-org/gitlab-pages/-/merge_requests/541")
enableDisk = flag.Bool("enable-disk", true, "Enable disk access, shall be disabled in environments where shared disk storage isn't available")
- clientID = flag.String("auth-client-id", "", "GitLab application Client ID")
- clientSecret = flag.String("auth-client-secret", "", "GitLab application Client Secret")
- redirectURI = flag.String("auth-redirect-uri", "", "GitLab application redirect URI")
- authScope = flag.String("auth-scope", "api", "Scope to be used for authentication (must match GitLab Pages OAuth application settings)")
- authTimeout = flag.Duration("auth-timeout", 5*time.Second, "GitLab application client timeout for authentication")
- maxConns = flag.Int("max-conns", 0, "Limit on the number of concurrent connections to the HTTP, HTTPS or proxy listeners, 0 for no limit")
- maxURILength = flag.Int("max-uri-length", 1024, "Limit the length of URI, 0 for unlimited.")
- insecureCiphers = flag.Bool("insecure-ciphers", false, "Use default list of cipher suites, may contain insecure ones like 3DES and RC4")
- tlsMinVersion = flag.String("tls-min-version", "tls1.2", tlsVersionFlagUsage("min"))
- tlsMaxVersion = flag.String("tls-max-version", "", tlsVersionFlagUsage("max"))
- zipCacheExpiration = flag.Duration("zip-cache-expiration", 60*time.Second, "Zip serving archive cache expiration interval")
- zipCacheCleanup = flag.Duration("zip-cache-cleanup", 30*time.Second, "Zip serving archive cache cleanup interval")
- zipCacheRefresh = flag.Duration("zip-cache-refresh", 30*time.Second, "Zip serving archive cache refresh interval")
- zipOpenTimeout = flag.Duration("zip-open-timeout", 30*time.Second, "Zip archive open timeout")
+ clientID = flag.String("auth-client-id", "", "GitLab application Client ID")
+ clientSecret = flag.String("auth-client-secret", "", "GitLab application Client Secret")
+ redirectURI = flag.String("auth-redirect-uri", "", "GitLab application redirect URI")
+ authScope = flag.String("auth-scope", "api", "Scope to be used for authentication (must match GitLab Pages OAuth application settings)")
+ authTimeout = flag.Duration("auth-timeout", 5*time.Second, "GitLab application client timeout for authentication")
+ maxConns = flag.Int("max-conns", 0, "Limit on the number of concurrent connections to the HTTP, HTTPS or proxy listeners, 0 for no limit")
+ maxURILength = flag.Int("max-uri-length", 1024, "Limit the length of URI, 0 for unlimited.")
+ insecureCiphers = flag.Bool("insecure-ciphers", false, "Use default list of cipher suites, may contain insecure ones like 3DES and RC4")
+ tlsMinVersion = flag.String("tls-min-version", "tls1.2", tlsVersionFlagUsage("min"))
+ tlsMaxVersion = flag.String("tls-max-version", "", tlsVersionFlagUsage("max"))
+ zipCacheExpiration = flag.Duration("zip-cache-expiration", 60*time.Second, "Zip serving archive cache expiration interval")
+ zipCacheCleanup = flag.Duration("zip-cache-cleanup", 30*time.Second, "Zip serving archive cache cleanup interval")
+ zipCacheRefresh = flag.Duration("zip-cache-refresh", 30*time.Second, "Zip serving archive cache refresh interval")
+ zipOpenTimeout = flag.Duration("zip-open-timeout", 30*time.Second, "Zip archive open timeout")
+ zipHTTPClientTimeout = flag.Duration("zip-http-client-timeout", 30*time.Minute, "Zip HTTP client timeout")
disableCrossOriginRequests = flag.Bool("disable-cross-origin-requests", false, "Disable cross-origin requests")
diff --git a/internal/vfs/zip/vfs.go b/internal/vfs/zip/vfs.go
index d0608c81..3fcef556 100644
--- a/internal/vfs/zip/vfs.go
+++ b/internal/vfs/zip/vfs.go
@@ -67,9 +67,7 @@ func New(cfg *config.ZipServing) vfs.VFS {
cacheCleanupInterval: cfg.CleanupInterval,
openTimeout: cfg.OpenTimeout,
httpClient: &http.Client{
- // TODO: make this timeout configurable
- // https://gitlab.com/gitlab-org/gitlab-pages/-/issues/457
- Timeout: 30 * time.Minute,
+ Timeout: cfg.HTTPClientTimeout,
Transport: httptransport.NewMeteredRoundTripper(
httptransport.NewTransport(),
"zip_vfs",