hliang 11 miesięcy temu
rodzic
commit
a7cd8427db
1 zmienionych plików z 11 dodań i 0 usunięć
  1. 11 0
      core/api.go

+ 11 - 0
core/api.go

@@ -312,6 +312,17 @@ func InitAPI(conf config.ConfStruct) {
 	if conf.HttpsServices.IsEnable {
 		sb.WriteString(" https监听地址:")
 		sb.WriteString(conf.HttpsServices.HttpsListen)
+		router.Use(tlsHandler(conf.HttpsServices.HttpsListen))
+		go func() {
+			err := router.RunTLS(
+				conf.HttpsServices.HttpsListen,
+				conf.HttpsServices.PemPath,
+				conf.HttpsServices.KeyPath,
+			)
+			if err != nil {
+				log.Error(err)
+			}
+		}()
 	}
 	log.Infoln(sb.String())