mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-01-09 10:07:17 +02:00
[#470] don't rely on the cwd and look for pb_public relative to pb_data
This commit is contained in:
parent
1ba2d14231
commit
ed5f3b86f5
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
@ -14,7 +15,7 @@ func main() {
|
||||
|
||||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||
// serves static files from the provided public dir (if exists)
|
||||
subFs := echo.MustSubFS(e.Router.Filesystem, "pb_public")
|
||||
subFs := echo.MustSubFS(e.Router.Filesystem, filepath.Join(app.DataDir(), "../pb_public"))
|
||||
e.Router.GET("/*", apis.StaticDirectoryHandler(subFs, false))
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user