tusd: Attempt to derive S3 region.

We already do this in computed_settings.py, but only if the
S3 (secret) key is set.  Those aren't required to be set, and tusd
_requires_ a region, so we try again to suss it out here.
This commit is contained in:
Alex Vandiver
2025-03-28 12:17:27 -04:00
committed by Tim Abbott
parent 794588629d
commit 9c043c6c14

View File

@@ -63,6 +63,10 @@ class Command(BaseCommand):
env_vars["AWS_ACCESS_KEY_ID"] = settings.S3_KEY
if settings.S3_SECRET_KEY is not None:
env_vars["AWS_SECRET_ACCESS_KEY"] = settings.S3_SECRET_KEY
assert settings.S3_REGION is not None
env_vars["AWS_REGION"] = settings.S3_REGION
if settings.S3_REGION is None:
import boto3
env_vars["AWS_REGION"] = boto3.client("s3").meta.region_name
else:
env_vars["AWS_REGION"] = settings.S3_REGION
os.execvpe("tusd", tusd_args, env_vars)