Skip to content
Snippets Groups Projects
Commit 52b3a6dd authored by ale's avatar ale
Browse files

Handle a null ServerConfig

parent 0a3d704c
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ type ServerConfig struct { ...@@ -30,6 +30,7 @@ type ServerConfig struct {
// SIGINT or SIGTERM and return nil. // SIGINT or SIGTERM and return nil.
func Serve(h http.Handler, serverConfig *ServerConfig, addr string) (err error) { func Serve(h http.Handler, serverConfig *ServerConfig, addr string) (err error) {
var tlsConfig *tls.Config var tlsConfig *tls.Config
if serverConfig != nil {
if serverConfig.TLS != nil { if serverConfig.TLS != nil {
tlsConfig, err = serverConfig.TLS.TLSConfig() tlsConfig, err = serverConfig.TLS.TLSConfig()
if err != nil { if err != nil {
...@@ -44,6 +45,7 @@ func Serve(h http.Handler, serverConfig *ServerConfig, addr string) (err error) ...@@ -44,6 +45,7 @@ func Serve(h http.Handler, serverConfig *ServerConfig, addr string) (err error)
if serverConfig.MaxInflightRequests > 0 { if serverConfig.MaxInflightRequests > 0 {
h = newLoadSheddingWrapper(serverConfig.MaxInflightRequests, h) h = newLoadSheddingWrapper(serverConfig.MaxInflightRequests, h)
} }
}
srv := &http.Server{ srv := &http.Server{
Addr: addr, Addr: addr,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment