[#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 (
|
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
|
||||||
|
|
Loading…
Reference in New Issue