Authelia users sync

This commit is contained in:
William Bouzourène 2026-04-30 14:45:39 +02:00
parent 9e1b06a448
commit 6654463aee
Signed by: bouzoure
GPG key ID: 423440D735B56BE2
5 changed files with 252 additions and 6 deletions

13
main.go
View file

@ -9,6 +9,7 @@ import (
"git.readonly.ch/bouzoure/pop-camarades/controllers"
"git.readonly.ch/bouzoure/pop-camarades/helpers"
"git.readonly.ch/bouzoure/pop-camarades/helpers/authelia"
"git.readonly.ch/bouzoure/pop-camarades/jobs"
"git.readonly.ch/bouzoure/pop-camarades/middlewares"
"github.com/flosch/pongo2/v6"
@ -57,6 +58,18 @@ func main() {
// Note: jobs will be executed at launch and after every interval
go helpers.RegisterJob(60*time.Minute, "clean saved sessions", jobs.CleanSavedSessions)
// Goroutine to update Authelia accounts in the background
go func() {
for {
err = authelia.SyncUsers()
if err != nil {
log.Error(err)
}
time.Sleep(time.Minute)
}
}()
// Initialize the Pongo2 templating engine
// If we are in dev mode, load templates from directory
// Otherwise, use the templates embedded in the binary