Don't use HTTP address for HTTPS whoops

This commit is contained in:
Neil Alexander 2020-04-20 16:21:26 +01:00
parent 9736ce7bbf
commit b2b3e08565
2 changed files with 6 additions and 6 deletions

View file

@ -102,11 +102,11 @@ func main() {
if *certFile != "" && *keyFile != "" {
go func() {
serv := http.Server{
Addr: *httpBindAddr,
Addr: *httpsBindAddr,
WriteTimeout: basecomponent.HTTPServerTimeout,
}
logrus.Info("Listening on ", *httpsBindAddr)
logrus.Info("Listening on ", serv.Addr)
logrus.Fatal(serv.ListenAndServeTLS(*certFile, *keyFile))
}()
}

View file

@ -210,20 +210,20 @@ func (b *BaseDendrite) SetupAndServeHTTP(bindaddr string, listenaddr string) {
addr = listenaddr
}
common.SetupHTTPAPI(http.DefaultServeMux, common.WrapHandlerInCORS(b.APIMux), b.Cfg)
logrus.Infof("Starting %s server on %s", b.componentName, addr)
serv := http.Server{
Addr: addr,
WriteTimeout: HTTPServerTimeout,
}
common.SetupHTTPAPI(http.DefaultServeMux, common.WrapHandlerInCORS(b.APIMux), b.Cfg)
logrus.Infof("Starting %s server on %s", b.componentName, serv.Addr)
err := serv.ListenAndServe()
if err != nil {
logrus.WithError(err).Fatal("failed to serve http")
}
logrus.Infof("Stopped %s server on %s", b.componentName, addr)
logrus.Infof("Stopped %s server on %s", b.componentName, serv.Addr)
}
// setupKafka creates kafka consumer/producer pair from the config.