Skip to content

Commit

Permalink
GBICSGO-1198: fixes default http client
Browse files Browse the repository at this point in the history
  • Loading branch information
KaanTolunayKilicOG committed Apr 11, 2024
1 parent 8170c77 commit f877577
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pkg/compliance/sink_project_only_for_backup_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package compliance
import (
"context"
"fmt"
"github.com/ottogroup/penelope/pkg/config"
"github.com/ottogroup/penelope/pkg/http/impersonate"
"go.opencensus.io/trace"
gimpersonate "google.golang.org/api/impersonate"
Expand Down Expand Up @@ -39,7 +40,10 @@ func NewSinkProjectOnlyForBackupCheckFunc(tokenSourceProvider impersonate.Target

options := []option.ClientOption{
option.WithTokenSource(tokenSource),
option.WithHTTPClient(http.DefaultClient),
}

if config.UseDefaultHttpClient.GetBoolOrDefault(false) {
options = append(options, option.WithHTTPClient(http.DefaultClient))
}

service, err := serviceusage.NewService(ctx, options...)
Expand Down
6 changes: 5 additions & 1 deletion pkg/compliance/sink_project_with_singler_writer_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"github.com/golang/glog"
"github.com/ottogroup/penelope/pkg/config"
"github.com/ottogroup/penelope/pkg/http/impersonate"
"go.opencensus.io/trace"
gimpersonate "google.golang.org/api/impersonate"
Expand Down Expand Up @@ -49,7 +50,10 @@ func NewSinkProjectWithSinglerWriterCheckFunc(tokenSourceProvider impersonate.Ta

options := []option.ClientOption{
option.WithTokenSource(tokenSource),
option.WithHTTPClient(http.DefaultClient),
}

if config.UseDefaultHttpClient.GetBoolOrDefault(false) {
options = append(options, option.WithHTTPClient(http.DefaultClient))
}

policiesClient, err := iam.NewPoliciesRESTClient(ctx, options...)
Expand Down

0 comments on commit f877577

Please sign in to comment.