separate frontend

This commit is contained in:
w-mj 2023-03-11 20:23:42 +08:00
parent 2cb68861aa
commit 1613c2839e
No known key found for this signature in database
GPG Key ID: 3A2CB5BE2F835897
3 changed files with 9 additions and 10 deletions

View File

@ -1,4 +1,4 @@
IMAGE_TAG ?= docker.educg.net/cg/k8s-manager:v1.1.1 IMAGE_TAG ?= docker.educg.net/cg/k8s-manager:v1.1.2
build: export CGO_ENABLED=0 build: export CGO_ENABLED=0
build: export GOOS=linux build: export GOOS=linux

View File

@ -17,7 +17,7 @@ spec:
serviceAccountName: dev serviceAccountName: dev
containers: containers:
- name: k8s-manager-pod - name: k8s-manager-pod
image: docker.educg.net/cg/k8s-manager:v1.0.4 image: docker.educg.net/cg/k8s-manager:v1.1.2
ports: ports:
- containerPort: 8080 - containerPort: 8080
env: env:

15
main.go
View File

@ -14,7 +14,6 @@ import (
"io/fs" "io/fs"
m "k8s-manager/src" m "k8s-manager/src"
"net/http" "net/http"
"os"
"strings" "strings"
) )
@ -164,13 +163,13 @@ func Login(c *gin.Context, username string) {
c.SetCookie("Authorization", "Bearer "+token, 0, "", "", false, false) c.SetCookie("Authorization", "Bearer "+token, 0, "", "", false, false)
c.Header("Authorization", "Bearer "+token) c.Header("Authorization", "Bearer "+token)
c.Header("Cache-Control", "no-store") c.Header("Cache-Control", "no-store")
redirectUrl := "" //redirectUrl := ""
if os.Getenv("URL_PREFIX") == "" { //if os.Getenv("URL_PREFIX") == "" {
redirectUrl = "/index" // redirectUrl = "/index"
} else { //} else {
redirectUrl = fmt.Sprintf("/%s/index", os.Getenv("URL_PREFIX")) // redirectUrl = fmt.Sprintf("/%s/index", os.Getenv("URL_PREFIX"))
} //}
c.Redirect(http.StatusTemporaryRedirect, redirectUrl) c.Redirect(http.StatusTemporaryRedirect, "/admin-page")
} }
func TestToken(c *gin.Context) { func TestToken(c *gin.Context) {