diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/config/config.go | 3 | ||||
-rw-r--r-- | internal/config/flags.go | 27 | ||||
-rw-r--r-- | internal/vfs/zip/vfs.go | 4 |
3 files changed, 18 insertions, 16 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index cef23be8..101bc701 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -134,6 +134,7 @@ type ZipServing struct { RefreshInterval time.Duration OpenTimeout time.Duration AllowedPaths []string + HTTPClientTimeout time.Duration } func internalGitlabServerFromFlags() string { @@ -238,6 +239,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 @@ -313,6 +315,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 5ddc7df6..425e55a2 100644 --- a/internal/config/flags.go +++ b/internal/config/flags.go @@ -66,19 +66,20 @@ 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)") - 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)") + 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", |