Add multi-profile support for S3-compatible backends
Summary
Add support for multiple S3-compatible backends (Cloudflare R2, DigitalOcean Spaces, MinIO, etc.) using the bucket@profile URL scheme:
-
s3://@profile/— list buckets on a named profile's endpoint -
s3://bucket@profile/key— access objects on a named profile -
s3://bucket/key— unchanged default behavior
Profiles are configured in ~/.config/kio_s3rc:
[Profile-r2]
EndpointUrl=https://ACCOUNT_ID.r2.cloudflarestorage.com
Region=auto
AwsProfile=r2
PathStyle=true
Changes
-
S3Url: profile-aware URL parsing —
profileName(),isProfileRoot(), updatedbucketName()to handleuserName()for profile URLs -
S3Backend:
createClientConfiguration()reads per-profile config fromkio_s3rc;createS3Client()usesProfileConfigFileAWSCredentialsProviderfor named profiles -
Listing:
listDir/stathandle profile root;listBuckets/listBucketgenerate profile-awareUDS_URLentries - Safety: cross-profile copy/rename guard (S3 CopyObject is single-endpoint)
- README: documented multi-profile setup
- Tests: added profile URL parsing test cases
Test plan
- Unit tests pass (16/16)
-
kioclient ls s3://— default profile works as before -
kioclient ls "s3://@r2/"— lists R2 buckets -
kioclient ls "s3://bucket@r2/"— lists objects on R2 -
kioclient ls "s3://@ocean/"— lists DigitalOcean Spaces buckets -
Backward compatible — no changes needed for existing
s3://bucket/URLs
Tested with Cloudflare R2 and DigitalOcean Spaces.
Context
This is MR 1 of 2. A follow-up MR will add a KCM module (System Settings UI) for managing profiles.