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,19 +30,21 @@ type ServerConfig struct { ...@@ -30,19 +30,21 @@ 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.TLS != nil { if serverConfig != nil {
tlsConfig, err = serverConfig.TLS.TLSConfig() if serverConfig.TLS != nil {
if err != nil { tlsConfig, err = serverConfig.TLS.TLSConfig()
return err if err != nil {
} return err
h, err = serverConfig.TLS.TLSAuthWrapper(h) }
if err != nil { h, err = serverConfig.TLS.TLSAuthWrapper(h)
return err if err != nil {
return err
}
} }
}
if serverConfig.MaxInflightRequests > 0 { if serverConfig.MaxInflightRequests > 0 {
h = newLoadSheddingWrapper(serverConfig.MaxInflightRequests, h) h = newLoadSheddingWrapper(serverConfig.MaxInflightRequests, h)
}
} }
srv := &http.Server{ srv := &http.Server{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment