2023-10-26 20:34:59 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-10-24 17:05:17 +00:00
|
|
|
"git.stuve.uni-ulm.de/stuve-it/stuve-it-backend/emailApi"
|
2024-11-07 17:13:25 +00:00
|
|
|
"git.stuve.uni-ulm.de/stuve-it/stuve-it-backend/eventEntriesNotifier"
|
2024-03-27 16:57:58 +00:00
|
|
|
"git.stuve.uni-ulm.de/stuve-it/stuve-it-backend/ldapApi"
|
2024-06-20 17:44:17 +00:00
|
|
|
"git.stuve.uni-ulm.de/stuve-it/stuve-it-backend/ldapSync"
|
2024-03-27 15:00:59 +00:00
|
|
|
"git.stuve.uni-ulm.de/stuve-it/stuve-it-backend/logger"
|
|
|
|
"git.stuve.uni-ulm.de/stuve-it/stuve-it-backend/qrApi"
|
2023-10-26 20:34:59 +00:00
|
|
|
"github.com/joho/godotenv"
|
|
|
|
"github.com/pocketbase/pocketbase"
|
|
|
|
"github.com/pocketbase/pocketbase/core"
|
|
|
|
"log"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
|
|
|
// load env
|
2024-10-24 17:05:17 +00:00
|
|
|
err := godotenv.Load(".env.local")
|
2024-03-27 14:36:45 +00:00
|
|
|
if err != nil {
|
2024-10-24 17:05:17 +00:00
|
|
|
logger.LogInfoF("The file '.env.local' could not be loaded: %v", err)
|
2024-03-27 14:36:45 +00:00
|
|
|
}
|
2023-10-26 20:34:59 +00:00
|
|
|
|
|
|
|
// create app
|
|
|
|
app := pocketbase.New()
|
|
|
|
|
|
|
|
// setup ldap sync
|
2024-11-07 17:13:25 +00:00
|
|
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error { return ldapSync.InitLdapSync(app) })
|
2023-10-26 20:34:59 +00:00
|
|
|
|
|
|
|
// setup ldap login
|
2024-11-07 17:13:25 +00:00
|
|
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error { return ldapApi.InitLdapApi(app, e) })
|
2023-10-26 20:34:59 +00:00
|
|
|
|
2024-03-27 14:36:45 +00:00
|
|
|
// setup qr api
|
2024-11-07 17:13:25 +00:00
|
|
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error { return qrApi.InitQRApi(app, e) })
|
2024-03-27 14:36:45 +00:00
|
|
|
|
2024-11-07 17:13:25 +00:00
|
|
|
// setup eventEntriesNotifier email notifications
|
|
|
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error { return eventEntriesNotifier.InitEventEntriesNotifier(app, e) })
|
2024-06-11 21:12:17 +00:00
|
|
|
|
2024-10-24 17:05:17 +00:00
|
|
|
// setup email api
|
|
|
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error { return emailApi.InitEmailApi(app, e) })
|
|
|
|
|
2023-10-26 20:34:59 +00:00
|
|
|
// start app
|
|
|
|
if err := app.Start(); err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|