fix #44 Support Zero downtime restarts for go servers
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package gopush
|
||||
import (
|
||||
"fmt"
|
||||
api "github.com/appleboy/gin-status-api"
|
||||
"github.com/fvbock/endless"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
@@ -76,9 +77,9 @@ func GetMainEngine() *gin.Engine {
|
||||
func RunHTTPServer() error {
|
||||
var err error
|
||||
if PushConf.Core.SSL && PushConf.Core.CertPath != "" && PushConf.Core.KeyPath != "" {
|
||||
err = GetMainEngine().RunTLS(":"+PushConf.Core.Port, PushConf.Core.CertPath, PushConf.Core.KeyPath)
|
||||
err = endless.ListenAndServeTLS(":"+PushConf.Core.Port, PushConf.Core.CertPath, PushConf.Core.KeyPath, GetMainEngine())
|
||||
} else {
|
||||
err = GetMainEngine().Run(":" + PushConf.Core.Port)
|
||||
err = endless.ListenAndServe(":"+PushConf.Core.Port, GetMainEngine())
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user