Skip to content

Commit

Permalink
remove no-longer used GCS creds helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
julio-lopez committed Oct 25, 2024
1 parent dd1991e commit c9bc399
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions repo/blob/gcs/gcs_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ package gcs

import (
"context"
"encoding/json"
"fmt"
"net/http"
"os"
"strconv"
"time"

gcsclient "cloud.google.com/go/storage"
"github.com/pkg/errors"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/api/googleapi"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
Expand Down Expand Up @@ -246,24 +242,6 @@ func (gcs *gcsStorage) toBlobID(blobName string) blob.ID {
return blob.ID(blobName[len(gcs.Prefix):])
}

func tokenSourceFromCredentialsFile(ctx context.Context, fn string, scopes ...string) (oauth2.TokenSource, error) {
data, err := os.ReadFile(fn) //nolint:gosec
if err != nil {
return nil, errors.Wrap(err, "error reading credentials file")
}

return tokenSourceFromCredentialsJSON(ctx, data, scopes...)
}

func tokenSourceFromCredentialsJSON(ctx context.Context, data json.RawMessage, scopes ...string) (oauth2.TokenSource, error) {
creds, err := google.CredentialsFromJSON(ctx, data, scopes...)
if err != nil {
return nil, errors.Wrap(err, "google.CredentialsFromJSON")
}

return creds.TokenSource, nil
}

// New creates new Google Cloud Storage-backed storage with specified options:
//
// - the 'BucketName' field is required and all other parameters are optional.
Expand Down

0 comments on commit c9bc399

Please sign in to comment.