feat(core): implement cordis configuration extension and migrate all plugins

This commit is contained in:
ryan
2026-08-29 10:53:53 +08:00
parent b43c429544
commit ed8491addf
74 changed files with 1354 additions and 1145 deletions
@@ -5,13 +5,13 @@
package driver_http
import (
"Wavelet/pkg/config"
"Wavelet/pkg/logger"
"Wavelet/pkg/response"
"context"
"net/http"
"strconv"
"strings"
"sync"
"time"
"github.com/gin-gonic/gin"
@@ -21,6 +21,26 @@ import (
otel_trace "Wavelet/pkg/trace"
)
var (
apiPrefixMu sync.RWMutex
apiPrefix = "/api/v1"
)
func setAPIPrefix(prefix string) {
if prefix == "" {
return
}
apiPrefixMu.Lock()
defer apiPrefixMu.Unlock()
apiPrefix = prefix
}
func getAPIPrefix() string {
apiPrefixMu.RLock()
defer apiPrefixMu.RUnlock()
return apiPrefix
}
func loggerMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
// 初始化 Trace
@@ -46,7 +66,7 @@ func loggerMiddleware() gin.HandlerFunc {
// 打印日志
// 排除健康检查接口
healthPath := config.Config.App.APIPrefix + "/health"
healthPath := getAPIPrefix() + "/health"
if c.Request.URL.Path != healthPath {
logger.InfoF(
ctx,