Skip to content

Commit

Permalink
test code
Browse files Browse the repository at this point in the history
  • Loading branch information
ddowker committed Apr 25, 2024
1 parent 4a8c2c1 commit 1909820
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions broker/fragment/store_gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ func (s *gcsBackend) SignGet(ep *url.URL, fragment pb.Fragment, d time.Duration)
opts.Expires = time.Now().Add(d)

if opts.GoogleAccessID == "" {
// workload identity approach
log.WithFields(log.Fields{
"bucket": cfg.bucket,
"prefix": cfg.prefix,
}).Info("SignGet with workload identity approach")
return client.Bucket(cfg.bucket).SignedURL(cfg.prefix, &opts)
} else {
return storage.SignedURL(cfg.bucket, cfg.rewritePath(cfg.prefix, fragment.ContentPath()), &opts)
Expand Down Expand Up @@ -188,6 +193,7 @@ func (s *gcsBackend) gcsClient(ep *url.URL) (cfg GSStoreConfig, client *storage.
return
}

// workload identity approach which aligns with a path in SignGet() method
opts = storage.SignedURLOptions{}
s.client, s.signedURLOptions = client, opts

Expand Down

0 comments on commit 1909820

Please sign in to comment.