瀏覽代碼

update ssl

hliang 11 月之前
父節點
當前提交
a7cd8427db
共有 1 個文件被更改,包括 11 次插入0 次删除
  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())