0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

feat: support artifacts search

https://github.com/cncf-tags/wg-artifacts/pull/34

An experiment to make this possible

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
Ramkumar Chinchani 2024-01-29 21:39:41 +00:00
parent 5ae7a028d9
commit 694ec3a782
No known key found for this signature in database
GPG key ID: 454D1719210F6D01
2 changed files with 15 additions and 0 deletions

View file

@ -16,6 +16,14 @@ const (
ExtSearchPrefix = ExtPrefix + ExtSearch
FullSearchPrefix = RoutePrefix + ExtSearchPrefix
// CNCF artifacts search extension.
BaseArtifactsPrefix = "/_artifacts"
ExtArtifactsPrefix = BaseArtifactsPrefix + "/ext"
ExtArtifactsSearch = "/search"
ExtArtifactsSearchPrefix = ExtArtifactsPrefix + ExtArtifactsSearch
FullSearchArtifactsPrefix = RoutePrefix + ExtArtifactsSearchPrefix
// mgmt extension.
Mgmt = "/mgmt"
ExtMgmt = ExtPrefix + Mgmt

View file

@ -102,4 +102,11 @@ func SetupSearchRoutes(conf *config.Config, router *mux.Router, storeController
Handler(gqlHandler.NewDefaultServer(gql_generated.NewExecutableSchema(resConfig)))
log.Info().Msg("finished setting up search routes")
extRouter = router.PathPrefix(constants.ExtArtifactsSearchPrefix).Subrouter()
extRouter.Use(zcommon.CORSHeadersMiddleware(conf.HTTP.AllowOrigin))
extRouter.Use(zcommon.ACHeadersMiddleware(conf, allowedMethods...))
extRouter.Use(zcommon.AddExtensionSecurityHeaders())
extRouter.Methods(allowedMethods...).
Handler(gqlHandler.NewDefaultServer(gql_generated.NewExecutableSchema(resConfig)))
}