Skip to content

Commit

Permalink
Add a transitive dependencies endpoint to the REST API (guacsec#1867)
Browse files Browse the repository at this point in the history
* client testing support

Signed-off-by: Marco Deicas <mdeicas@google.com>

* Add HashEquals and IsOccurrences queries to gql client

Signed-off-by: Marco Deicas <mdeicas@google.com>

* Change Paginate to take pointer to PaginationSpec

Signed-off-by: Marco Deicas <mdeicas@google.com>

* Add better logging

Signed-off-by: Marco Deicas <mdeicas@google.com>

* Implement transitive dependency search

Signed-off-by: Marco Deicas <mdeicas@google.com>

---------

Signed-off-by: Marco Deicas <mdeicas@google.com>
Signed-off-by: Soham Arora <arorasoham9@gmail.com>
  • Loading branch information
mdeicas authored and arorasoham9 committed May 17, 2024
1 parent c9119a8 commit 5c19d0a
Show file tree
Hide file tree
Showing 25 changed files with 2,710 additions and 90 deletions.
11 changes: 5 additions & 6 deletions cmd/guacrest/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ import (
"github.com/guacsec/guac/pkg/logging"
)

// TODO: add logging middleware
// TODO: add context propagation middleware

func startServer() {
ctx := logging.WithLogger(context.Background())
logger := logging.FromContext(ctx)
Expand All @@ -47,10 +44,12 @@ func startServer() {

httpClient := &http.Client{Transport: transport}
gqlClient := getGraphqlServerClientOrExit(ctx, httpClient)
handler := server.NewDefaultServer(gqlClient)
handlerWrapper := gen.NewStrictHandler(handler, nil)

restApiHandler := gen.Handler(gen.NewStrictHandler(server.NewDefaultServer(gqlClient), nil))

router := chi.NewRouter()
router.Mount("/", gen.Handler(handlerWrapper))
router.Use(server.AddLoggerToCtxMiddleware, server.LogRequestsMiddleware)
router.Mount("/", restApiHandler)
server := http.Server{
Addr: fmt.Sprintf(":%d", flags.restAPIServerPort),
Handler: router,
Expand Down
Loading

0 comments on commit 5c19d0a

Please sign in to comment.