wip: go embedded worker

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt
2025-06-06 16:16:26 +02:00
parent 40dbac7a65
commit 5acdd67cba
5 changed files with 68 additions and 129 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"net/url"
"syscall"
"time"
"github.com/getsentry/sentry-go"
@ -19,6 +20,7 @@ import (
sentryutils "goauthentik.io/internal/utils/sentry"
webutils "goauthentik.io/internal/utils/web"
"goauthentik.io/internal/web"
"goauthentik.io/internal/worker"
)
var rootCmd = &cobra.Command{
@ -65,6 +67,14 @@ var rootCmd = &cobra.Command{
panic(err)
}
worker := worker.New()
if config.Get().Worker.Embedded {
err = worker.Start()
if err != nil {
panic(err)
}
}
ws := web.NewWebServer()
ws.Core().AddHealthyCallback(func() {
if config.Get().Outposts.DisableEmbeddedOutpost {
@ -76,6 +86,7 @@ var rootCmd = &cobra.Command{
<-ex
l.Info("shutting down webserver")
go ws.Shutdown()
go worker.Kill(syscall.SIGTERM)
},
}