Skip to content

Commit

Permalink
Allow passing custom query params to minio
Browse files Browse the repository at this point in the history
Part of wiring up custom parameters to server access logging. This is
done by adding additional query parameters prefixed with `x-` to
requests.

This contains support for GET requests only and must be used in
conjunction with an updated version of minio.
  • Loading branch information
ashmrtn committed Jan 16, 2024
1 parent eb3fbfa commit a89f532
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions repo/blob/s3/s3_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Options struct {
SecretAccessKey string `json:"secretAccessKey" kopia:"sensitive"`
SessionToken string `json:"sessionToken" kopia:"sensitive"`
Tags map[string]string `json:"tags" kopia:"sensitive"`
QueryParams map[string]string `json:"queryParams" kopia:"sensitive"`
RoleARN string `json:"roleARN"`
SessionName string `json:"sessionName"`
RoleDuration string `json:"duration"`
Expand Down
4 changes: 4 additions & 0 deletions repo/blob/s3/s3_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func (s *s3Storage) getBlobWithVersion(ctx context.Context, b blob.ID, version s
attempt := func() error {
opt := minio.GetObjectOptions{VersionID: version}

for k, v := range s.QueryParams {
opt.AddReqParam(k, v)
}

if length > 0 {
if err := opt.SetRange(offset, offset+length-1); err != nil {
return errors.Wrap(blob.ErrInvalidRange, "unable to set range")
Expand Down

0 comments on commit a89f532

Please sign in to comment.