The root package is now the entry point: one binary that serves the PocketBase API, applies the migrations and ships the SvelteKit build from web/build as a single-page app. The legacy chi entry point is gone. Note that the image is embedded unconditionally, so a Go build needs at least the tracked web/build/.gitkeep and a web build has to run first to get a working UI.
29 lines
613 B
Go
29 lines
613 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
_ "time/tzdata"
|
|
|
|
"github.com/pocketbase/pocketbase"
|
|
"github.com/pocketbase/pocketbase/plugins/migratecmd"
|
|
"github.com/wotra/wotra/internal/legacyimport"
|
|
_ "github.com/wotra/wotra/internal/migrations"
|
|
"github.com/wotra/wotra/internal/syncapi"
|
|
"github.com/wotra/wotra/internal/tracking"
|
|
)
|
|
|
|
func main() {
|
|
app := pocketbase.New()
|
|
|
|
migratecmd.MustRegister(app, app.RootCmd, migratecmd.Config{Automigrate: false})
|
|
|
|
syncapi.Register(app)
|
|
tracking.Register(app)
|
|
legacyimport.Register(app, app.RootCmd)
|
|
registerUI(app)
|
|
|
|
if err := app.Start(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|