Skip to content

Commit

Permalink
[s3] add support for setting "cloudfront_key_id" and "cloudfront_key"…
Browse files Browse the repository at this point in the history
… through OPTIONS (#1274)
  • Loading branch information
PetrDlouhy authored Sep 2, 2023
1 parent 8e6ebf5 commit 0e6f10f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions storages/backends/s3boto3.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ class S3Boto3Storage(CompressStorageMixin, BaseStorage):
config = None

def __init__(self, **settings):
cloudfront_key_id = settings.pop("cloudfront_key_id", None)
cloudfront_key = settings.pop("cloudfront_key", None)

super().__init__(**settings)

check_location(self)
Expand All @@ -281,6 +284,9 @@ def __init__(self, **settings):
if self.transfer_config is None:
self.transfer_config = TransferConfig(use_threads=self.use_threads)

if cloudfront_key_id and cloudfront_key:
self.cloudfront_signer = self.get_cloudfront_signer(cloudfront_key_id, cloudfront_key)

def get_cloudfront_signer(self, key_id, key):
return _cloud_front_signer_from_pem(key_id, key)

Expand Down

0 comments on commit 0e6f10f

Please sign in to comment.