replace AnalysePackage with QueryPackageAnalysis API & use community API (#15)

This commit is contained in:
Sahil Bansal
2025-05-11 22:41:34 +05:30
committed by GitHub
parent 6a28fb16a1
commit 86f8bd42b7
5 changed files with 15 additions and 48 deletions
+1 -10
View File
@@ -5,20 +5,11 @@ import (
"net/http"
drygrpc "github.com/safedep/dry/adapters/grpc"
"github.com/safedep/pmg/pkg/common/utils"
"google.golang.org/grpc"
)
func NewCloudClientConnection() (*grpc.ClientConn, error) {
tok := utils.ApiKey()
tenantId := utils.TenantDomain()
if tok == "" || tenantId == "" {
return nil, fmt.Errorf("SAFEDEP_API_KEY and SAFEDEP_TENANT_ID must be set")
}
headers := http.Header{}
headers.Set("x-tenant-id", tenantId)
cc, err := newGrpcClient(headers, tok, "pmg-pkg-scan", "api.safedep.io", "443")
cc, err := newGrpcClient(http.Header{}, "", "pmg-pkg-scan", "community-api.safedep.io", "443")
if err != nil {
return nil, fmt.Errorf("failed to create gRPC client: %v", err)
}