Skip to content

Commit

Permalink
re-add boto3 endpoint_url and set default to None
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-muchiri committed Feb 7, 2024
1 parent fb387c8 commit d2e094e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions onadata/libs/utils/image_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ def generate_aws_media_url(
"""Generate S3 URL."""
s3_class = get_storage_class("storages.backends.s3boto3.S3Boto3Storage")()
bucket_name = s3_class.bucket.name
aws_endpoint_url = getattr(settings, "AWS_S3_ENDPOINT_URL", None)
s3_config = Config(
signature_version=getattr(settings, "AWS_S3_SIGNATURE_VERSION", "s3v4"),
region_name=getattr(settings, "AWS_S3_REGION_NAME", ""),
)
s3_client = boto3.client(
"s3",
config=s3_config,
endpoint_url=aws_endpoint_url,
aws_access_key_id=s3_class.access_key,
aws_secret_access_key=s3_class.secret_key,
region_name=s3_class.region_name,
Expand Down

0 comments on commit d2e094e

Please sign in to comment.