Skip to content

Commit

Permalink
feat: support artifacts search
Browse files Browse the repository at this point in the history
cncf-tags/wg-artifacts#34

An experiment to make this possible

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
  • Loading branch information
rchincha committed Jan 29, 2024
1 parent 9def35f commit cb5b60e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/api/constants/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions pkg/extensions/extension_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}

0 comments on commit cb5b60e

Please sign in to comment.