Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Use public-read for S3-enabled storage of thumbnails by default #217

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions icekit/project/settings/calculated.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@

# STORAGES ####################################################################

# Override media and thumbnail storage if S3 media is enabled
if ENABLE_S3_MEDIA:
DEFAULT_FILE_STORAGE = 'icekit.utils.storage.S3DefaultStorage'
THUMBNAIL_DEFAULT_STORAGE = DEFAULT_FILE_STORAGE
# "Private" S3 storage by default for most media assets
DEFAULT_FILE_STORAGE = 'icekit.utils.storage.S3DefaultPrivateStorage'

# "Public" S3 storage by default for thumbnails
THUMBNAIL_DEFAULT_STORAGE = 'icekit.utils.storage.S3DefaultPublicStorage'
15 changes: 14 additions & 1 deletion icekit/utils/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, *args, **kwargs):
# STORAGE CLASSES #############################################################


class S3DefaultStorage(
class S3DefaultPrivateStorage(
# HashedMediaMixin,
S3MediaLocationMixin,
S3PrivateMixin,
Expand All @@ -63,4 +63,17 @@ class S3DefaultStorage(
pass


class S3DefaultPublicStorage(
# HashedMediaMixin,
S3MediaLocationMixin,
S3PublicMixin,
S3Boto3Storage):

pass


# TODO Deprecated, use `S3DefaultPrivateStorage` instead of `S3DefaultStorage`
S3DefaultStorage = S3DefaultPrivateStorage


default_storage = get_storage_class(settings.DEFAULT_FILE_STORAGE)()