Skip to content

Commit

Permalink
Add support for passing Blob Query Params
Browse files Browse the repository at this point in the history
  • Loading branch information
khrm committed Oct 7, 2024
1 parent ad8fdc9 commit 4cf0e53
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/provider/blob/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ const (
cacheFile = "cache.tar.gz"
)

var (
queryParams string
)

func init() {
queryParams = os.Getenv("BLOB_QUERY_PARAMS")
}

func Fetch(ctx context.Context, url url.URL, folder string) error {
log.Printf("Downloading cache from %s to %s", url.String(), folder)
file, err := os.CreateTemp("", cacheFile)
Expand All @@ -28,7 +36,7 @@ func Fetch(ctx context.Context, url url.URL, folder string) error {
}
defer os.Remove(file.Name())

bucket, err := blob.OpenBucket(ctx, url.String()+"?usePathStyle=true")
bucket, err := blob.OpenBucket(ctx, url.String()+queryParams)
if err != nil {
log.Printf("error opening bucket: %s", err)
return err
Expand Down Expand Up @@ -68,7 +76,7 @@ func Upload(ctx context.Context, url url.URL, folder string) error {
return err
}

bucket, err := blob.OpenBucket(ctx, url.String()+"?usePathStyle=true")
bucket, err := blob.OpenBucket(ctx, url.String()+queryParams)
if err != nil {
return err
}
Expand Down

0 comments on commit 4cf0e53

Please sign in to comment.