mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-07-16 17:48:51 +02:00
33 lines
734 B
Go
33 lines
734 B
Go
package main
|
|
|
|
import (
|
|
"github.com/pocketbase/pocketbase"
|
|
"github.com/pocketbase/pocketbase/plugins/migratecmd"
|
|
_ "htwkalender/migrations"
|
|
"htwkalender/service"
|
|
"log/slog"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func main() {
|
|
app := pocketbase.New()
|
|
|
|
// loosely check if it was executed using "go run"
|
|
isGoRun := strings.HasPrefix(os.Args[0], os.TempDir())
|
|
|
|
migratecmd.MustRegister(app, app.RootCmd, migratecmd.Config{
|
|
// enable auto creation of migration files when making collection changes in the Admin UI
|
|
// (the isGoRun check is to enable it only during development)
|
|
Automigrate: isGoRun,
|
|
})
|
|
|
|
service.AddRoutes(app)
|
|
|
|
service.AddSchedules(app)
|
|
|
|
if err := app.Start(); err != nil {
|
|
slog.Error("Failed to start app: %v", err)
|
|
}
|
|
}
|