Default region if endpoint specified

This commit is contained in:
Ben Johnson
2021-03-09 15:38:32 -07:00
parent 3598d8b572
commit 896aef070c

View File

@@ -732,10 +732,14 @@ func (r *Replica) Init(ctx context.Context) (err error) {
// Endpoints are typically used for non-S3 object stores and do not
// necessarily require a region.
region := r.Region
if region == "" && r.Endpoint == "" {
if region == "" {
if r.Endpoint == "" {
if region, err = r.findBucketRegion(ctx, r.Bucket); err != nil {
return fmt.Errorf("cannot lookup bucket region: %w", err)
}
} else {
region = "us-east-1" // default for non-S3 object stores
}
}
// Create new AWS session.