Skip to content

Commit ef60296

Browse files
committed
construct base_url differently if region is set and endpoint contains amazonaws
1 parent 266f8b5 commit ef60296

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ def __init__(self, config):
102102

103103
# construct base url for bucket
104104
scheme = "https://" if config.as_bool("minio.secure") else "http://"
105-
self.base_url = scheme + config.minio.endpoint + "/" + self.bucket
105+
106+
if config.minio.region and "amazonaws" in config.minio.endpoint.lower():
107+
self.base_url = (
108+
f"{scheme}{self.bucket}.s3.{config.minio.region}.amazonaws.com"
109+
)
110+
else:
111+
self.base_url = scheme + config.minio.endpoint + "/" + self.bucket
106112
except S3Error as e:
107113
raise DriverError("MinIO driver init error: " + str(e))
108114

0 commit comments

Comments
 (0)