49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"git.stuve.uni-ulm.de/stuve-it/stuve-it-backend/ldapLogin"
|
|
"git.stuve.uni-ulm.de/stuve-it/stuve-it-backend/ldapSync"
|
|
"git.stuve.uni-ulm.de/stuve-it/stuve-it-backend/logger"
|
|
"git.stuve.uni-ulm.de/stuve-it/stuve-it-backend/qrApi"
|
|
"github.com/joho/godotenv"
|
|
"github.com/pocketbase/pocketbase"
|
|
"github.com/pocketbase/pocketbase/core"
|
|
"log"
|
|
)
|
|
|
|
func main() {
|
|
|
|
// load env
|
|
err := godotenv.Load(".env.local")
|
|
if err != nil {
|
|
logger.LogInfoF("The file '.env.local' could not be loaded.")
|
|
}
|
|
err = godotenv.Load(".env")
|
|
if err != nil {
|
|
logger.LogInfoF("The file '.env' could not be loaded.")
|
|
}
|
|
|
|
// create app
|
|
app := pocketbase.New()
|
|
|
|
// setup ldap sync
|
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
|
return ldapSync.InitLdapSync(app)
|
|
})
|
|
|
|
// setup ldap login
|
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
|
return ldapLogin.InitLDAPLogin(app, e)
|
|
})
|
|
|
|
// setup qr api
|
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
|
return qrApi.InitQRApi(app, e)
|
|
})
|
|
|
|
// start app
|
|
if err := app.Start(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|