mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-22 10:15:47 +08:00
Add frontendBaseDir
This commit is contained in:
parent
938e8e2699
commit
6a9d1e0fe5
@ -8,12 +8,12 @@ dbName = casdoor
|
||||
tableNamePrefix =
|
||||
showSql = false
|
||||
redisEndpoint =
|
||||
defaultStorageProvider =
|
||||
defaultStorageProvider =
|
||||
isCloudIntranet = false
|
||||
authState = "casdoor"
|
||||
socks5Proxy = "127.0.0.1:10808"
|
||||
verificationCodeTimeout = 10
|
||||
initScore = 2000
|
||||
initScore = 0
|
||||
logPostOnly = true
|
||||
origin =
|
||||
staticBaseUrl = "https://cdn.casbin.org"
|
||||
@ -24,4 +24,5 @@ radiusServerPort = 1812
|
||||
radiusSecret = "secret"
|
||||
quota = {"organization": -1, "user": -1, "application": -1, "provider": -1}
|
||||
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"
|
||||
newStaticBaseUrl = conf.GetConfigString("staticBaseUrl")
|
||||
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) {
|
||||
urlPath := ctx.Request.URL.Path
|
||||
|
||||
@ -49,7 +60,8 @@ func StaticFilter(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
path := "web/build"
|
||||
webBuildFolder := getWebBuildFolder()
|
||||
path := webBuildFolder
|
||||
if urlPath == "/" {
|
||||
path += "/index.html"
|
||||
} else {
|
||||
@ -57,7 +69,7 @@ func StaticFilter(ctx *context.Context) {
|
||||
}
|
||||
|
||||
if !util.FileExist(path) {
|
||||
path = "web/build/index.html"
|
||||
path = webBuildFolder + "/index.html"
|
||||
}
|
||||
if !util.FileExist(path) {
|
||||
dir, err := os.Getwd()
|
||||
|
Loading…
x
Reference in New Issue
Block a user