chore: ignore FRONTEND_BASE_URL on master node

This commit is contained in:
JustSong 2023-07-02 16:07:12 +08:00
parent 9ec6506c32
commit edc5156693

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"net/http" "net/http"
"one-api/common"
"os" "os"
"strings" "strings"
) )
@ -14,6 +15,10 @@ func SetRouter(router *gin.Engine, buildFS embed.FS, indexPage []byte) {
SetDashboardRouter(router) SetDashboardRouter(router)
SetRelayRouter(router) SetRelayRouter(router)
frontendBaseUrl := os.Getenv("FRONTEND_BASE_URL") frontendBaseUrl := os.Getenv("FRONTEND_BASE_URL")
if common.IsMasterNode && frontendBaseUrl != "" {
frontendBaseUrl = ""
common.SysLog("FRONTEND_BASE_URL is ignored on master node")
}
if frontendBaseUrl == "" { if frontendBaseUrl == "" {
SetWebRouter(router, buildFS, indexPage) SetWebRouter(router, buildFS, indexPage)
} else { } else {