wip: go embedded worker
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
@ -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)
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user