Move https server in go func to not block http server

This commit is contained in:
Jannis Mattheis 2018-03-18 16:04:33 +01:00 committed by Jannis Mattheis
parent d931dfc696
commit 6b537c956b
1 changed files with 3 additions and 1 deletions

View File

@ -38,7 +38,9 @@ func Run(engine *gin.Engine, conf *config.Configuration) {
s.TLSConfig = &tls.Config{GetCertificate: certManager.GetCertificate}
}
fmt.Println("Started Listening on port", conf.Server.SSL.Port)
go log.Fatal(s.ListenAndServeTLS(conf.Server.SSL.CertFile, conf.Server.SSL.CertKey))
go func() {
log.Fatal(s.ListenAndServeTLS(conf.Server.SSL.CertFile, conf.Server.SSL.CertKey))
}()
}
fmt.Println("Started Listening on port", conf.Server.Port)
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", conf.Server.Port), httpHandler))