Skip to content

Commit

Permalink
resource/url: update metadata scope, and projectID to 'with context' …
Browse files Browse the repository at this point in the history
…variants
  • Loading branch information
prestist committed Nov 11, 2024
1 parent 488ce74 commit 44d5a70
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/resource/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,8 @@ func (f *Fetcher) fetchFromGCS(u url.URL, dest io.Writer, opts FetchOptions) err
if metadata.OnGCE() {
// check whether the VM is associated with a service
// account
if _, err := metadata.Scopes(""); err == nil {
id, _ := metadata.ProjectID()
if _, err := metadata.ScopesWithContext(ctx, ""); err == nil {
id, _ := metadata.ProjectIDWithContext(ctx)
creds := &google.Credentials{
ProjectID: id,
TokenSource: google.ComputeTokenSource("", storage.ScopeReadOnly),
Expand Down

0 comments on commit 44d5a70

Please sign in to comment.