From 5bc4d39c2581ab0418d1f58bdac5c12d9714c16d Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Mon, 16 Sep 2024 20:48:13 +0000 Subject: [PATCH] settings: Attempt to detect S3_REGION if left blank. --- zproject/computed_settings.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zproject/computed_settings.py b/zproject/computed_settings.py index 04b65e9e80..b3e798a38d 100644 --- a/zproject/computed_settings.py +++ b/zproject/computed_settings.py @@ -52,6 +52,7 @@ from .configured_settings import ( REMOTE_POSTGRES_PORT, REMOTE_POSTGRES_SSLMODE, ROOT_SUBDOMAIN_ALIASES, + S3_REGION, SENTRY_DSN, SOCIAL_AUTH_APPLE_APP_ID, SOCIAL_AUTH_APPLE_SERVICES_ID, @@ -511,6 +512,10 @@ ROOT_DOMAIN_URI = EXTERNAL_URI_SCHEME + EXTERNAL_HOST S3_KEY = get_secret("s3_key") S3_SECRET_KEY = get_secret("s3_secret_key") +if S3_KEY is not None and S3_SECRET_KEY is not None and S3_REGION is None: + import boto3 + + S3_REGION = boto3.client("s3").meta.region_name DROPBOX_APP_KEY = get_secret("dropbox_app_key")