Skip to content

Commit 52b7d93

Browse files
committed
use the same region for the aws client and the bucket
1 parent 7e0f3d7 commit 52b7d93

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • libsql-wal/src/storage/backend

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

Lines changed: 5 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,7 @@ 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(aws_sdk_s3::types::BucketLocationConstraint::from_str(&region.to_string()).unwrap())
8184
.build();
8285

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

0 commit comments

Comments
 (0)