use object_store::aws::AmazonS3Builder;
pub fn s3_builder(bucket: &str, region: Option<&str>, endpoint: Option<&str>) -> AmazonS3Builder {
let mut builder = AmazonS3Builder::from_env().with_bucket_name(bucket);
if let Some(region) = region {
builder = builder.with_region(region);
}
if let Some(endpoint) = endpoint {
builder = builder
.with_endpoint(endpoint)
.with_allow_http(endpoint.starts_with("http://"))
.with_virtual_hosted_style_request(false);
}
builder
}