settings: S3 is enabled if LOCAL_UPLOADS_DIR is unset.

We should not key off of `S3_KEY`/`S3_SECRET_KEY`, since those are
optional if the host is in EC2 and using instance profiles.  Instead,
check if `LOCAL_UPLOADS_DIR` is None1, which is the authoritative
source for if the S3 backend is in use.
This commit is contained in:
Alex Vandiver
2025-04-10 14:42:22 +00:00
committed by Tim Abbott
parent a09dab5eaf
commit ba5d1108c0

View File

@@ -514,7 +514,7 @@ 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:
if LOCAL_UPLOADS_DIR is None and S3_REGION is None:
import boto3
S3_REGION = boto3.client("s3").meta.region_name