This commit is contained in:
jinnrry 2023-11-01 10:20:27 +08:00
parent 2ec333f6f5
commit 712873370a
3 changed files with 10 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package http_server
import (
"fmt"
log "github.com/sirupsen/logrus"
"io/fs"
"net/http"
"pmail/config"
@ -28,6 +29,8 @@ func HttpStart() {
HttpPort = config.Instance.HttpPort
}
log.Infof("HttpServer Start On Port :%d", HttpPort)
if config.Instance.HttpsEnabled != 2 {
mux.HandleFunc("/", controllers.Interceptor)
httpServer = &http.Server{

View File

@ -34,7 +34,6 @@ func (w *nullWrite) Write(p []byte) (int, error) {
}
func HttpsStart() {
log.Infof("Http Server Start")
mux := http.NewServeMux()
@ -73,6 +72,8 @@ func HttpsStart() {
HttpsPort = config.Instance.HttpsPort
}
log.Infof("Https Server Start On Port :%d", HttpsPort)
if config.Instance.HttpsEnabled != 2 {
httpsServer = &http.Server{
Addr: fmt.Sprintf(":%d", HttpsPort),

View File

@ -1,6 +1,7 @@
package res_init
import (
"encoding/json"
log "github.com/sirupsen/logrus"
"os"
"pmail/config"
@ -39,6 +40,10 @@ func Init() {
// http server start
go http_server.HttpsStart()
go http_server.HttpStart()
configStr, _ := json.Marshal(config.Instance)
log.Warnf("Config File Info: %s", configStr)
<-signal.RestartChan
log.Infof("Server Restart!")
smtp_server.Stop()