summaryrefslogtreecommitdiff
path: root/app/init.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-30 12:10:43 -0600
committermo khan <mo@mokhan.ca>2025-07-30 12:10:43 -0600
commitebb003ef2beaeee61104d6b88a342c5c9fa73b51 (patch)
tree7b72d99a6257b636a9a844602f469975853e3b0e /app/init.go
parenta9a093fcc7a4e0c65f363eb2e2439631062de645 (diff)
parentd4f4f72b5ff586f2ff440f19f61d2fe48be89a37 (diff)
Merge branch 'secure-repository' into 'main'
Authorize reading/writing Sparkles using SpiceDB See merge request gitlab-org/software-supply-chain-security/authorization/sparkled!20
Diffstat (limited to 'app/init.go')
-rw-r--r--app/init.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/app/init.go b/app/init.go
index ea67e48..8e5e0e5 100644
--- a/app/init.go
+++ b/app/init.go
@@ -19,6 +19,7 @@ import (
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/domain"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/jobs"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/authz"
+ "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web"
)
@@ -47,7 +48,13 @@ func init() {
))
})
ioc.RegisterSingleton[domain.Repository[*domain.Sparkle]](c, func() domain.Repository[*domain.Sparkle] {
- return db.NewRepository[*domain.Sparkle](ioc.MustResolve[*event.TypedAggregator[*domain.Sparkle]](c))
+ aggregator := ioc.MustResolve[*event.TypedAggregator[*domain.Sparkle]](c)
+ client := ioc.MustResolve[*authzed.Client](c)
+
+ return db.NewRepository[*domain.Sparkle](
+ db.WithAuthorization[*domain.Sparkle](client),
+ db.WithPublishing(aggregator),
+ )
})
ioc.RegisterSingleton[*http.ServeMux](c, func() *http.ServeMux {
return http.NewServeMux()
@@ -83,9 +90,7 @@ func init() {
logger := ioc.MustResolve[*zerolog.Logger](c)
ctx := logger.WithContext(context.Background())
- client := ioc.MustResolve[*authzed.Client](c)
-
- ioc.
- MustResolve[*event.TypedAggregator[*domain.Sparkle]](c).
- SubscribeTo("after.create", jobs.NewCreateSparkle(ctx, client).Run)
+ if err := jobs.Boot(ctx, c); err != nil {
+ pls.LogErrorNow(ctx, err)
+ }
}