From f78d8d18b960f66a2a4f4e2044e2159647d375af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Emre=20Aksoy?= Date: Fri, 4 Mar 2022 05:38:51 +0000 Subject: feat: make server shutdown timeout configurable Changelog: added --- internal/config/config.go | 20 +++++++++++--------- internal/config/flags.go | 1 + 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'internal') diff --git a/internal/config/config.go b/internal/config/config.go index 24a811ec..cef23be8 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -35,15 +35,16 @@ type Config struct { // General groups settings that are general to GitLab Pages and can not // be categorized under other head. type General struct { - Domain string - MaxConns int - MaxURILength int - MetricsAddress string - RedirectHTTP bool - RootCertificate []byte - RootDir string - RootKey []byte - StatusPath string + Domain string + MaxConns int + MaxURILength int + MetricsAddress string + RedirectHTTP bool + RootCertificate []byte + RootDir string + RootKey []byte + ServerShutdownTimeout time.Duration + StatusPath string DisableCrossOriginRequests bool InsecureCiphers bool @@ -177,6 +178,7 @@ func loadConfig() (*Config, error) { RedirectHTTP: *redirectHTTP, RootDir: *pagesRoot, StatusPath: *pagesStatus, + ServerShutdownTimeout: *serverShutdownTimeout, DisableCrossOriginRequests: *disableCrossOriginRequests, InsecureCiphers: *insecureCiphers, PropagateCorrelationID: *propagateCorrelationID, diff --git a/internal/config/flags.go b/internal/config/flags.go index 409ecdc7..5ddc7df6 100644 --- a/internal/config/flags.go +++ b/internal/config/flags.go @@ -47,6 +47,7 @@ var ( _ = flag.Bool("daemon-enable-jail", false, "DEPRECATED and ignored, will be removed in 15.0") _ = flag.Bool("daemon-inplace-chroot", false, "DEPRECATED and ignored, will be removed in 15.0") // TODO: https://gitlab.com/gitlab-org/gitlab-pages/-/issues/599 propagateCorrelationID = flag.Bool("propagate-correlation-id", false, "Reuse existing Correlation-ID from the incoming request header `X-Request-ID` if present") + serverShutdownTimeout = flag.Duration("server-shutdown-timeout", 30*time.Second, "GitLab Pages server shutdown timeout (default: 30s)") logFormat = flag.String("log-format", "json", "The log output format: 'text' or 'json'") logVerbose = flag.Bool("log-verbose", false, "Verbose logging") secret = flag.String("auth-secret", "", "Cookie store hash key, should be at least 32 bytes long") -- cgit v1.2.3