Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

s3: Add a setting for S3 addressing style.

Alex Vandiver75d6f35069a4
diff --git a/zerver/lib/upload/s3.py b/zerver/lib/upload/s3.py
index 7b4099057f4..d22c85099de 100644
--- a/zerver/lib/upload/s3.py
+++ b/zerver/lib/upload/s3.py
@@ -65,6 +65,7 @@ def get_bucket(bucket_name: str, authed: bool = True) -> Bucket:
endpoint_url=settings.S3_ENDPOINT_URL,
config=Config(
signature_version=None if authed else botocore.UNSIGNED,
+ s3={"addressing_style": settings.S3_ADDRESSING_STYLE},
),
).Bucket(bucket_name)
diff --git a/zproject/default_settings.py b/zproject/default_settings.py
index 0f6e3a22baf..91d0ef9c59a 100644
--- a/zproject/default_settings.py
+++ b/zproject/default_settings.py
@@ -148,6 +148,7 @@ S3_AVATAR_BUCKET = ""
S3_AUTH_UPLOADS_BUCKET = ""
S3_REGION: Optional[str] = None
S3_ENDPOINT_URL: Optional[str] = None
+S3_ADDRESSING_STYLE: Literal["auto", "virtual", "path"] = "auto"
S3_SKIP_PROXY = True
S3_UPLOADS_STORAGE_CLASS: Literal[
"GLACIER_IR",
diff --git a/zproject/prod_settings_template.py b/zproject/prod_settings_template.py
index 63969f5efce..adc18a92cdd 100644
--- a/zproject/prod_settings_template.py
+++ b/zproject/prod_settings_template.py
@@ -788,6 +788,7 @@ LOCAL_UPLOADS_DIR = "/home/zulip/uploads"
# S3_AVATAR_BUCKET = ""
# S3_REGION = None
# S3_ENDPOINT_URL = None
+# S3_ADDRESSING_STYLE = "auto"
# S3_SKIP_PROXY = True
# S3_UPLOADS_STORAGE_CLASS = "STANDARD"