mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-22 18:25:47 +08:00
Add frontendBaseDir
This commit is contained in:
parent
938e8e2699
commit
6a9d1e0fe5
@ -13,7 +13,7 @@ isCloudIntranet = false
|
|||||||
authState = "casdoor"
|
authState = "casdoor"
|
||||||
socks5Proxy = "127.0.0.1:10808"
|
socks5Proxy = "127.0.0.1:10808"
|
||||||
verificationCodeTimeout = 10
|
verificationCodeTimeout = 10
|
||||||
initScore = 2000
|
initScore = 0
|
||||||
logPostOnly = true
|
logPostOnly = true
|
||||||
origin =
|
origin =
|
||||||
staticBaseUrl = "https://cdn.casbin.org"
|
staticBaseUrl = "https://cdn.casbin.org"
|
||||||
@ -25,3 +25,4 @@ radiusSecret = "secret"
|
|||||||
quota = {"organization": -1, "user": -1, "application": -1, "provider": -1}
|
quota = {"organization": -1, "user": -1, "application": -1, "provider": -1}
|
||||||
logConfig = {"filename": "logs/casdoor.log", "maxdays":99999, "perm":"0770"}
|
logConfig = {"filename": "logs/casdoor.log", "maxdays":99999, "perm":"0770"}
|
||||||
initDataFile = "./init_data.json"
|
initDataFile = "./init_data.json"
|
||||||
|
frontendBaseDir = "../casdoor"
|
@ -33,8 +33,19 @@ var (
|
|||||||
oldStaticBaseUrl = "https://cdn.casbin.org"
|
oldStaticBaseUrl = "https://cdn.casbin.org"
|
||||||
newStaticBaseUrl = conf.GetConfigString("staticBaseUrl")
|
newStaticBaseUrl = conf.GetConfigString("staticBaseUrl")
|
||||||
enableGzip = conf.GetConfigBool("enableGzip")
|
enableGzip = conf.GetConfigBool("enableGzip")
|
||||||
|
frontendBaseDir = conf.GetConfigString("frontendBaseDir")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func getWebBuildFolder() string {
|
||||||
|
path := "web/build"
|
||||||
|
if util.FileExist(filepath.Join(path, "index.html")) || frontendBaseDir == "" {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
path = filepath.Join(frontendBaseDir, "web/build")
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
func StaticFilter(ctx *context.Context) {
|
func StaticFilter(ctx *context.Context) {
|
||||||
urlPath := ctx.Request.URL.Path
|
urlPath := ctx.Request.URL.Path
|
||||||
|
|
||||||
@ -49,7 +60,8 @@ func StaticFilter(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
path := "web/build"
|
webBuildFolder := getWebBuildFolder()
|
||||||
|
path := webBuildFolder
|
||||||
if urlPath == "/" {
|
if urlPath == "/" {
|
||||||
path += "/index.html"
|
path += "/index.html"
|
||||||
} else {
|
} else {
|
||||||
@ -57,7 +69,7 @@ func StaticFilter(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !util.FileExist(path) {
|
if !util.FileExist(path) {
|
||||||
path = "web/build/index.html"
|
path = webBuildFolder + "/index.html"
|
||||||
}
|
}
|
||||||
if !util.FileExist(path) {
|
if !util.FileExist(path) {
|
||||||
dir, err := os.Getwd()
|
dir, err := os.Getwd()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user