mirror of
https://github.com/icereed/paperless-gpt.git
synced 2025-03-14 13:48:00 -05:00
feat: allow setting of path to load static files from
This commit is contained in:
parent
17ae37b590
commit
1d7f3349ba
1 changed files with 7 additions and 3 deletions
10
main.go
10
main.go
|
@ -38,6 +38,7 @@ var (
|
||||||
visionLlmModel = os.Getenv("VISION_LLM_MODEL")
|
visionLlmModel = os.Getenv("VISION_LLM_MODEL")
|
||||||
logLevel = strings.ToLower(os.Getenv("LOG_LEVEL"))
|
logLevel = strings.ToLower(os.Getenv("LOG_LEVEL"))
|
||||||
listenInterface = os.Getenv("LISTEN_INTERFACE")
|
listenInterface = os.Getenv("LISTEN_INTERFACE")
|
||||||
|
webuiPath = os.Getenv("WEBUI_PATH")
|
||||||
|
|
||||||
// Templates
|
// Templates
|
||||||
titleTemplate *template.Template
|
titleTemplate *template.Template
|
||||||
|
@ -188,13 +189,16 @@ func main() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if webuiPath == "" {
|
||||||
|
webuiPath = "./web-app/dist"
|
||||||
|
}
|
||||||
// Serve static files for the frontend under /assets
|
// Serve static files for the frontend under /assets
|
||||||
router.StaticFS("/assets", gin.Dir("./web-app/dist/assets", true))
|
router.StaticFS("/assets", gin.Dir(webuiPath+"/assets", true))
|
||||||
router.StaticFile("/vite.svg", "./web-app/dist/vite.svg")
|
router.StaticFile("/vite.svg", webuiPath+"/vite.svg")
|
||||||
|
|
||||||
// Catch-all route for serving the frontend
|
// Catch-all route for serving the frontend
|
||||||
router.NoRoute(func(c *gin.Context) {
|
router.NoRoute(func(c *gin.Context) {
|
||||||
c.File("./web-app/dist/index.html")
|
c.File(webuiPath + "/index.html")
|
||||||
})
|
})
|
||||||
|
|
||||||
// Start OCR worker pool
|
// Start OCR worker pool
|
||||||
|
|
Loading…
Reference in a new issue