Default region if endpoint specified
This commit is contained in:
6
s3/s3.go
6
s3/s3.go
@@ -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
|
// 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 r.Endpoint == "" {
|
||||||
if region, err = r.findBucketRegion(ctx, r.Bucket); err != nil {
|
if region, err = r.findBucketRegion(ctx, r.Bucket); err != nil {
|
||||||
return fmt.Errorf("cannot lookup bucket region: %w", err)
|
return fmt.Errorf("cannot lookup bucket region: %w", err)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
region = "us-east-1" // default for non-S3 object stores
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new AWS session.
|
// Create new AWS session.
|
||||||
|
|||||||
Reference in New Issue
Block a user