diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2022-05-19 13:04:25 +0400 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2022-05-19 18:53:08 +0400 |
commit | cbce19dac2b5033e6b969b3e82ec6aad2e247757 (patch) | |
tree | 10ed772a5bbb25589b22c375cfd1e638deba1452 /cmd/gitlab-sshd/main.go | |
parent | bfa6fe4de784926cabd5bd5fd26eb6978c8095b9 (diff) | |
download | gitlab-shell-cbce19dac2b5033e6b969b3e82ec6aad2e247757.tar.gz |
Allow specifying formatted durations in config
- If an integer is specified, we assume that these are seconds
- A duration of format "500ms", "10s", "1m", etc... accepted
Diffstat (limited to 'cmd/gitlab-sshd/main.go')
-rw-r--r-- | cmd/gitlab-sshd/main.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd/gitlab-sshd/main.go b/cmd/gitlab-sshd/main.go index 8040a54..16fbca0 100644 --- a/cmd/gitlab-sshd/main.go +++ b/cmd/gitlab-sshd/main.go @@ -99,11 +99,12 @@ func main() { sig := <-done signal.Reset(syscall.SIGINT, syscall.SIGTERM) - log.WithContextFields(ctx, log.Fields{"shutdown_timeout_s": cfg.Server.GracePeriodSeconds, "signal": sig.String()}).Info("Shutdown initiated") + gracePeriod := time.Duration(cfg.Server.GracePeriod) + log.WithContextFields(ctx, log.Fields{"shutdown_timeout_s": gracePeriod.Seconds(), "signal": sig.String()}).Info("Shutdown initiated") server.Shutdown() - <-time.After(cfg.Server.GracePeriod()) + <-time.After(gracePeriod) cancel() |