Skip to content

Commit 109d483

Browse files
authored
Merge pull request #1703 from tursodatabase/use-client-region-for-bucket
use the same region for the aws client and the bucket
2 parents 89e2b2e + 5782686 commit 109d483

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • libsql-wal/src/storage/backend

libsql-wal/src/storage/backend/s3.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::fmt;
44
use std::mem::size_of;
55
use std::path::Path;
66
use std::pin::Pin;
7+
use std::str::FromStr;
78
use std::sync::Arc;
89
use std::task::Poll;
910

@@ -68,6 +69,9 @@ impl<IO: Io> S3Backend<IO> {
6869
.to_builder()
6970
.force_path_style(true)
7071
.build();
72+
73+
let region = config.region().expect("region must be configured").clone();
74+
7175
let client = Client::from_conf(config);
7276
let config = S3Config {
7377
bucket,
@@ -76,8 +80,9 @@ impl<IO: Io> S3Backend<IO> {
7680
};
7781

7882
let bucket_config = CreateBucketConfiguration::builder()
79-
// TODO: get location from config
80-
.location_constraint(aws_sdk_s3::types::BucketLocationConstraint::UsWest2)
83+
.location_constraint(
84+
aws_sdk_s3::types::BucketLocationConstraint::from_str(&region.to_string()).unwrap(),
85+
)
8186
.build();
8287

8388
// TODO: we may need to create the bucket for config overrides. Maybe try lazy bucket

0 commit comments

Comments
 (0)