diff options
author | Nick Thomas <nick@gitlab.com> | 2021-07-15 12:44:48 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2021-07-15 12:44:48 +0000 |
commit | 60a91e977cb76e2cc49faeeac134640dbf2e2e6c (patch) | |
tree | b693a2244f3d715d48df83eac70bdf6630e51d3a /internal/config/config.go | |
parent | d3711d8d7e781dbff01d8ae5c7a1d5b800c5c8a2 (diff) | |
parent | 569a0197cacc75270776217c27e9d709907a9dfa (diff) | |
download | gitlab-shell-60a91e977cb76e2cc49faeeac134640dbf2e2e6c.tar.gz |
Merge branch 'id-cancelable-sshd' into 'main'
Shutdown sshd gracefully
See merge request gitlab-org/gitlab-shell!484
Diffstat (limited to 'internal/config/config.go')
-rw-r--r-- | internal/config/config.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 23044cd..c58ea7d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -8,6 +8,7 @@ import ( "path" "path/filepath" "sync" + "time" "gitlab.com/gitlab-org/labkit/tracing" yaml "gopkg.in/yaml.v2" @@ -25,6 +26,7 @@ type ServerConfig struct { ProxyProtocol bool `yaml:"proxy_protocol,omitempty"` WebListen string `yaml:"web_listen,omitempty"` ConcurrentSessionsLimit int64 `yaml:"concurrent_sessions_limit,omitempty"` + GracePeriodSeconds uint64 `yaml:"grace_period"` HostKeyFiles []string `yaml:"host_key_files,omitempty"` } @@ -69,6 +71,7 @@ var ( Listen: "[::]:22", WebListen: "localhost:9122", ConcurrentSessionsLimit: 10, + GracePeriodSeconds: 10, HostKeyFiles: []string{ "/run/secrets/ssh-hostkeys/ssh_host_rsa_key", "/run/secrets/ssh-hostkeys/ssh_host_ecdsa_key", @@ -77,6 +80,10 @@ var ( } ) +func (sc *ServerConfig) GracePeriod() time.Duration { + return time.Duration(sc.GracePeriodSeconds) * time.Second +} + func (c *Config) ApplyGlobalState() { if c.SslCertDir != "" { os.Setenv("SSL_CERT_DIR", c.SslCertDir) |