Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Go Test

on:
pull_request:
push:
branches:
- develop

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Test
run: go test ./...
- name: Build
run: go build ./...
4 changes: 4 additions & 0 deletions s3store.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ func ParseS3URL(s3URL *url.URL) (configOptions []func(*awsconfig.LoadOptions) er
))
}

if profile := s3URL.Query().Get("profile"); profile != "" {
configOptions = append(configOptions, awsconfig.WithSharedConfigProfile(profile))
}

return configOptions, bucket, strings.Trim(path, "/"), getStorageClass(s3URL.Query()), nil
}

Expand Down
12 changes: 12 additions & 0 deletions s3store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,15 @@ func TestParseS3URL(t *testing.T) {
})
}
}

func TestParseS3URL_Profile(t *testing.T) {
baseURL, err := url.Parse("s3://s3.example.com/my-bucket?region=us-east-1&profile=myprofile")
require.NoError(t, err)

configOptions, bucket, path, _, err := ParseS3URL(baseURL)
require.NoError(t, err)
assert.Equal(t, "my-bucket", bucket)
assert.Equal(t, "", path)
// profile adds one extra config option (region + endpoint + profile = 3)
assert.Equal(t, 3, len(configOptions))
}
Loading