From d1181b3e7a3aa6ab279714dcccde043b1b0d14bf Mon Sep 17 00:00:00 2001 From: Rafael Castillo Date: Wed, 8 Sep 2021 12:55:58 -0700 Subject: [PATCH] Check for TLS config in wss listeners Previously http.Server.ListenAndServeTLS would return a not very helpful error about a failed open. This adds a check similar to the one in the ircs case that should make it clearer to operators what the error is. --- cmd/soju/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/soju/main.go b/cmd/soju/main.go index 974881b..9f67182 100644 --- a/cmd/soju/main.go +++ b/cmd/soju/main.go @@ -156,6 +156,9 @@ func main() { } }() case "wss": + if tlsCfg == nil { + log.Fatalf("failed to listen on %q: missing TLS configuration", listen) + } addr := u.Host if _, _, err := net.SplitHostPort(addr); err != nil { addr = addr + ":https"