[#470] don't rely on the cwd and look for pb_public relative to pb_data

This commit is contained in:
Gani Georgiev 2022-09-15 22:52:24 +03:00
parent 1ba2d14231
commit ed5f3b86f5
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package main
import ( import (
"log" "log"
"path/filepath"
"github.com/labstack/echo/v5" "github.com/labstack/echo/v5"
"github.com/pocketbase/pocketbase" "github.com/pocketbase/pocketbase"
@ -14,7 +15,7 @@ func main() {
app.OnBeforeServe().Add(func(e *core.ServeEvent) error { app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
// serves static files from the provided public dir (if exists) // 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)) e.Router.GET("/*", apis.StaticDirectoryHandler(subFs, false))
return nil return nil