Skip to content

refactor: extract shared S3 client config into global config block#231

Merged
alecthomas merged 1 commit intomainfrom
refactor/shared-s3-client
Mar 29, 2026
Merged

refactor: extract shared S3 client config into global config block#231
alecthomas merged 1 commit intomainfrom
refactor/shared-s3-client

Conversation

@alecthomas
Copy link
Copy Markdown
Collaborator

@alecthomas alecthomas commented Mar 29, 2026

Pull S3 connection config (endpoint, region, SSL settings) and minio
client construction out of the S3 cache backend into a new s3client
package, following the same pattern as gitclone.Config/ManagerProvider.

  • Add internal/s3client with Config, ClientProvider, and NewClient
  • Config is an optional HCL block in GlobalConfig
  • ClientProvider lazily constructs a singleton *minio.Client
  • NewClient verifies connectivity via ListBuckets up front
  • S3Config retains only cache-specific fields (bucket, TTL, upload tuning)
  • RegisterS3/NewS3 accept a ClientProvider parameter
  • Move minitest to s3client/s3clienttest with deterministic per-package
    bucket names derived from runtime caller inspection, cleaning stale
    objects up front and via t.Cleanup

Example config:

s3 {
  endpoint       = "s3.amazonaws.com"
  region         = "us-west-2"
  use-ssl        = true
  skip-ssl-verify = false
}

cache s3 {
  bucket            = "my-cache-bucket"
  max-ttl           = "1h"
  upload-concurrency = 4
  upload-part-size-mb = 16
}

Pull S3 connection config (endpoint, region, SSL settings) and minio
client construction out of the S3 cache backend into a new s3client
package, following the same pattern as gitclone.Config/ManagerProvider.

- Add internal/s3client with Config, ClientProvider, and NewClient
- Config is an optional HCL block in GlobalConfig
- ClientProvider lazily constructs a singleton *minio.Client
- NewClient verifies connectivity via ListBuckets up front
- S3Config retains only cache-specific fields (bucket, TTL, upload tuning)
- RegisterS3/NewS3 accept a ClientProvider parameter
- Move minitest to s3client/s3clienttest with deterministic per-package
  bucket names derived from runtime caller inspection, cleaning stale
  objects up front and via t.Cleanup

Co-authored-by: Claude Code <noreply@anthropic.com>
@alecthomas alecthomas requested a review from a team as a code owner March 29, 2026 23:19
@alecthomas alecthomas requested review from worstell and removed request for a team March 29, 2026 23:19
@alecthomas alecthomas merged commit 2ebe893 into main Mar 29, 2026
8 checks passed
@alecthomas alecthomas deleted the refactor/shared-s3-client branch March 29, 2026 23:27
alecthomas added a commit that referenced this pull request Mar 30, 2026
)

Pull S3 connection config (endpoint, region, SSL settings) and minio
client construction out of the S3 cache backend into a new s3client
package, following the same pattern as gitclone.Config/ManagerProvider.

- Add internal/s3client with Config, ClientProvider, and NewClient
- Config is an optional HCL block in GlobalConfig
- ClientProvider lazily constructs a singleton *minio.Client
- NewClient verifies connectivity via ListBuckets up front
- S3Config retains only cache-specific fields (bucket, TTL, upload
tuning)
- RegisterS3/NewS3 accept a ClientProvider parameter
- Move minitest to s3client/s3clienttest with deterministic per-package
  bucket names derived from runtime caller inspection, cleaning stale
  objects up front and via t.Cleanup

Example config:

```hcl
s3 {
  endpoint       = "s3.amazonaws.com"
  region         = "us-west-2"
  use-ssl        = true
  skip-ssl-verify = false
}

cache s3 {
  bucket            = "my-cache-bucket"
  max-ttl           = "1h"
  upload-concurrency = 4
  upload-part-size-mb = 16
}
```

Co-authored-by: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant