36 lines
690 B
Go
36 lines
690 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"github.com/joho/godotenv"
|
||
|
"github.com/pocketbase/pocketbase"
|
||
|
"github.com/pocketbase/pocketbase/core"
|
||
|
"gitlab.uni-ulm.de/stuve-it/it-tools/backend/ldapLogin"
|
||
|
"gitlab.uni-ulm.de/stuve-it/it-tools/backend/ldapSync"
|
||
|
"log"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
|
||
|
// load env
|
||
|
godotenv.Load(".env.local")
|
||
|
godotenv.Load(".env")
|
||
|
|
||
|
// 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)
|
||
|
})
|
||
|
|
||
|
// start app
|
||
|
if err := app.Start(); err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
}
|