Skip to content

Commit

Permalink
increase write timeout for guard (#328)
Browse files Browse the repository at this point in the history
* Raise writetimeout for guard

Signed-off-by: Anumita <[email protected]>

* parametrize write timeout

Signed-off-by: Anumita <[email protected]>

* solving check issues

Signed-off-by: Anumita <[email protected]>
  • Loading branch information
Anumita authored Sep 7, 2021
1 parent 4026cc9 commit 7b94cc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/reference/guard_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ guard run [flags]
--ldap.user-search-filter string Filter to apply when searching user (default "(objectClass=person)")
--max-clock-skew duration Max acceptable clock skew for server clock (default 2m0s)
--ntp-server string Address of NTP serer used to check clock skew (default "0.pool.ntp.org")
--server-write-timeout Guard http server write timeout. Default is 10 seconds.
--secure-addr string host:port used to serve secure apis (default ":8443")
--tls-ca-file string File containing CA certificate
--tls-cert-file string File container server TLS certificate
Expand Down
4 changes: 3 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ type Server struct {
AuthRecommendedOptions *AuthRecommendedOptions
AuthzRecommendedOptions *AuthzRecommendedOptions
TokenAuthenticator *token.Authenticator
WriteTimeout time.Duration
}

func (s *Server) AddFlags(fs *pflag.FlagSet) {
fs.DurationVar(&s.WriteTimeout, "server-write-timeout", 10*time.Second, "Guard http server write timeout. Default is 10 seconds.")
s.AuthRecommendedOptions.AddFlags(fs)
s.AuthzRecommendedOptions.AddFlags(fs)
}
Expand Down Expand Up @@ -190,7 +192,7 @@ func (s Server) ListenAndServe() {
srv := &http.Server{
Addr: s.AuthRecommendedOptions.SecureServing.SecureAddr,
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
WriteTimeout: s.WriteTimeout,
Handler: m,
TLSConfig: tlsConfig,
}
Expand Down

0 comments on commit 7b94cc7

Please sign in to comment.