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,9 +732,13 @@ func (r *Replica) Init(ctx context.Context) (err error) {
// Endpoints are typically used for non-S3 object stores and do not // Endpoints are typically used for non-S3 object stores and do not
// necessarily require a region. // necessarily require a region.
region := r.Region region := r.Region
if region == "" && r.Endpoint == "" { if region == "" {
if region, err = r.findBucketRegion(ctx, r.Bucket); err != nil { if r.Endpoint == "" {
return fmt.Errorf("cannot lookup bucket region: %w", err) 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
} }
} }