Skip to content

Commit

Permalink
TC-1781 Ingestor TLS management (guacsec#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrizzi authored Sep 18, 2024
1 parent 882ab4a commit 0a5d272
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions pkg/assembler/clients/helpers/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
"github.com/spf13/viper"
)

func GetGqlClient(graphqlEndpoint string) (graphql.Client, error) {
httpClient := http.Client{}
func GetGqlClient(graphqlEndpoint string, httpClient http.Client) (graphql.Client, error) {
certFile := viper.GetString("gql-tls-root-ca")
insecure := viper.GetBool("gql-tls-insecure")
if certFile != "" {
Expand Down
8 changes: 5 additions & 3 deletions pkg/ingestor/ingestor.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (

"go.uber.org/zap"

"github.com/Khan/genqlient/graphql"
"github.com/guacsec/guac/pkg/assembler"
"github.com/guacsec/guac/pkg/assembler/clients/helpers"
csub_client "github.com/guacsec/guac/pkg/collectsub/client"
Expand Down Expand Up @@ -172,8 +171,11 @@ func GetAssembler(
transport http.RoundTripper,
) func([]assembler.IngestPredicates) error {
httpClient := http.Client{Transport: transport}
gqlclient := graphql.NewClient(graphqlEndpoint, &httpClient)
f := helpers.GetBulkAssembler(ctx, childLogger, gqlclient)
gqlClient, err := helpers.GetGqlClient(graphqlEndpoint, httpClient)
if err != nil {
fmt.Printf("unable to create GraphQL client: %v", err)
}
f := helpers.GetBulkAssembler(ctx, childLogger, gqlClient)
return f
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/ingestor/parser/csaf/parser_csaf_red_hat.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package csaf
import (
"context"
"fmt"
"net/http"
"sort"
"strings"

Expand Down Expand Up @@ -62,7 +63,7 @@ func (c *csafParserRedHat) findPkgSpec(ctx context.Context, product_id string) (
if !ok {
return nil, fmt.Errorf("unable to locate product url for reference %s due to missing graphqlEndpoint value", *pref)
}
gqlclient, err := assembler_helpers.GetGqlClient(endpoint)
gqlclient, err := assembler_helpers.GetGqlClient(endpoint, http.Client{})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 0a5d272

Please sign in to comment.