Wire accessreview.Service into server and probod
Add AccessReview field to server.Config and api.Config, pass through to console and MCP NewMux. Create the service in probod and run its background workers. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -42,6 +42,7 @@ import (
|
|||||||
"go.gearno.de/kit/pg"
|
"go.gearno.de/kit/pg"
|
||||||
"go.gearno.de/kit/unit"
|
"go.gearno.de/kit/unit"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
"go.probo.inc/probo/pkg/accessreview"
|
||||||
"go.probo.inc/probo/pkg/awsconfig"
|
"go.probo.inc/probo/pkg/awsconfig"
|
||||||
"go.probo.inc/probo/pkg/baseurl"
|
"go.probo.inc/probo/pkg/baseurl"
|
||||||
"go.probo.inc/probo/pkg/certmanager"
|
"go.probo.inc/probo/pkg/certmanager"
|
||||||
@@ -481,6 +482,7 @@ func (impl *Implm) Run(
|
|||||||
slackService,
|
slackService,
|
||||||
iamService,
|
iamService,
|
||||||
esignService,
|
esignService,
|
||||||
|
defaultConnectorRegistry,
|
||||||
time.Duration(impl.cfg.Auth.InvitationConfirmationTokenValidity)*time.Second,
|
time.Duration(impl.cfg.Auth.InvitationConfirmationTokenValidity)*time.Second,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -503,6 +505,13 @@ func (impl *Implm) Run(
|
|||||||
|
|
||||||
fileService := file.NewService(pgClient, fileManagerService)
|
fileService := file.NewService(pgClient, fileManagerService)
|
||||||
|
|
||||||
|
accessReviewService := accessreview.NewService(
|
||||||
|
pgClient,
|
||||||
|
encryptionKey,
|
||||||
|
defaultConnectorRegistry,
|
||||||
|
l.Named("access-review"),
|
||||||
|
)
|
||||||
|
|
||||||
serverHandler, err := server.NewServer(
|
serverHandler, err := server.NewServer(
|
||||||
server.Config{
|
server.Config{
|
||||||
AllowedOrigins: impl.cfg.Api.Cors.AllowedOrigins,
|
AllowedOrigins: impl.cfg.Api.Cors.AllowedOrigins,
|
||||||
@@ -512,6 +521,7 @@ func (impl *Implm) Run(
|
|||||||
IAM: iamService,
|
IAM: iamService,
|
||||||
Trust: trustService,
|
Trust: trustService,
|
||||||
ESign: esignService,
|
ESign: esignService,
|
||||||
|
AccessReview: accessReviewService,
|
||||||
Mailman: mailmanService,
|
Mailman: mailmanService,
|
||||||
Slack: slackService,
|
Slack: slackService,
|
||||||
ConnectorRegistry: defaultConnectorRegistry,
|
ConnectorRegistry: defaultConnectorRegistry,
|
||||||
@@ -605,6 +615,15 @@ func (impl *Implm) Run(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
accessReviewWorkerCtx, stopAccessReviewWorker := context.WithCancel(context.Background())
|
||||||
|
wg.Go(
|
||||||
|
func() {
|
||||||
|
if err := accessReviewService.Run(accessReviewWorkerCtx); err != nil {
|
||||||
|
cancel(fmt.Errorf("access review source fetcher crashed: %w", err))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
iamServiceCtx, stopIAMService := context.WithCancel(context.Background())
|
iamServiceCtx, stopIAMService := context.WithCancel(context.Background())
|
||||||
wg.Go(
|
wg.Go(
|
||||||
func() {
|
func() {
|
||||||
@@ -685,6 +704,7 @@ func (impl *Implm) Run(
|
|||||||
stopMailingListWorker()
|
stopMailingListWorker()
|
||||||
stopEvidenceDescriptionWorker()
|
stopEvidenceDescriptionWorker()
|
||||||
stopExportJobExporter()
|
stopExportJobExporter()
|
||||||
|
stopAccessReviewWorker()
|
||||||
stopIAMService()
|
stopIAMService()
|
||||||
stopMailer()
|
stopMailer()
|
||||||
stopSlackSender()
|
stopSlackSender()
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import (
|
|||||||
"github.com/go-chi/cors"
|
"github.com/go-chi/cors"
|
||||||
"go.gearno.de/kit/httpserver"
|
"go.gearno.de/kit/httpserver"
|
||||||
"go.gearno.de/kit/log"
|
"go.gearno.de/kit/log"
|
||||||
|
"go.probo.inc/probo/pkg/accessreview"
|
||||||
"go.probo.inc/probo/pkg/baseurl"
|
"go.probo.inc/probo/pkg/baseurl"
|
||||||
"go.probo.inc/probo/pkg/connector"
|
"go.probo.inc/probo/pkg/connector"
|
||||||
"go.probo.inc/probo/pkg/esign"
|
"go.probo.inc/probo/pkg/esign"
|
||||||
@@ -52,6 +53,7 @@ type (
|
|||||||
IAM *iam.Service
|
IAM *iam.Service
|
||||||
Trust *trust.Service
|
Trust *trust.Service
|
||||||
ESign *esign.Service
|
ESign *esign.Service
|
||||||
|
AccessReview *accessreview.Service
|
||||||
Slack *slack.Service
|
Slack *slack.Service
|
||||||
Mailman *mailman.Service
|
Mailman *mailman.Service
|
||||||
Cookie securecookie.Config
|
Cookie securecookie.Config
|
||||||
@@ -161,6 +163,7 @@ func NewServer(cfg Config) (*Server, error) {
|
|||||||
cfg.Probo,
|
cfg.Probo,
|
||||||
cfg.IAM,
|
cfg.IAM,
|
||||||
cfg.ESign,
|
cfg.ESign,
|
||||||
|
cfg.AccessReview,
|
||||||
cfg.Mailman,
|
cfg.Mailman,
|
||||||
cfg.Cookie,
|
cfg.Cookie,
|
||||||
cfg.TokenSecret,
|
cfg.TokenSecret,
|
||||||
@@ -176,6 +179,7 @@ func NewServer(cfg Config) (*Server, error) {
|
|||||||
cfg.Logger.Named("mcp.v1"),
|
cfg.Logger.Named("mcp.v1"),
|
||||||
cfg.Probo,
|
cfg.Probo,
|
||||||
cfg.IAM,
|
cfg.IAM,
|
||||||
|
cfg.AccessReview,
|
||||||
cfg.TokenSecret,
|
cfg.TokenSecret,
|
||||||
),
|
),
|
||||||
slackHandler: slack_v1.NewMux(
|
slackHandler: slack_v1.NewMux(
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import (
|
|||||||
"go.gearno.de/kit/httpserver"
|
"go.gearno.de/kit/httpserver"
|
||||||
"go.gearno.de/kit/log"
|
"go.gearno.de/kit/log"
|
||||||
"go.gearno.de/x/ref"
|
"go.gearno.de/x/ref"
|
||||||
|
"go.probo.inc/probo/pkg/accessreview"
|
||||||
"go.probo.inc/probo/pkg/baseurl"
|
"go.probo.inc/probo/pkg/baseurl"
|
||||||
"go.probo.inc/probo/pkg/connector"
|
"go.probo.inc/probo/pkg/connector"
|
||||||
"go.probo.inc/probo/pkg/esign"
|
"go.probo.inc/probo/pkg/esign"
|
||||||
@@ -50,6 +51,7 @@ type Config struct {
|
|||||||
IAM *iam.Service
|
IAM *iam.Service
|
||||||
Trust *trust.Service
|
Trust *trust.Service
|
||||||
ESign *esign.Service
|
ESign *esign.Service
|
||||||
|
AccessReview *accessreview.Service
|
||||||
Slack *slack.Service
|
Slack *slack.Service
|
||||||
Mailman *mailman.Service
|
Mailman *mailman.Service
|
||||||
Cookie securecookie.Config
|
Cookie securecookie.Config
|
||||||
@@ -80,6 +82,7 @@ func NewServer(cfg Config) (*Server, error) {
|
|||||||
IAM: cfg.IAM,
|
IAM: cfg.IAM,
|
||||||
Trust: cfg.Trust,
|
Trust: cfg.Trust,
|
||||||
ESign: cfg.ESign,
|
ESign: cfg.ESign,
|
||||||
|
AccessReview: cfg.AccessReview,
|
||||||
Slack: cfg.Slack,
|
Slack: cfg.Slack,
|
||||||
Mailman: cfg.Mailman,
|
Mailman: cfg.Mailman,
|
||||||
Cookie: cfg.Cookie,
|
Cookie: cfg.Cookie,
|
||||||
|
|||||||
Reference in New Issue
Block a user