From b351e267e1f04ed8380e6f76ae11b5efc923cd9a Mon Sep 17 00:00:00 2001 From: Helder Souza <42891390+helllllllder@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:13:04 -0300 Subject: [PATCH] Feature/presigned url on medias (#408) * feat: add private media storage * feat: update querystring_auth on PrivateMediaStorage to True, to be able to use pre signed url * feat: remove PrivateMediaStorage, as it's not needed anymore * feat: remove update on excelstorage * feat: use env var on s3 config --- chats/apps/msgs/models.py | 5 ++++- chats/settings.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/chats/apps/msgs/models.py b/chats/apps/msgs/models.py index 2f037733..2a80bac1 100644 --- a/chats/apps/msgs/models.py +++ b/chats/apps/msgs/models.py @@ -114,7 +114,10 @@ class MessageMedia(BaseModel): ) content_type = models.CharField(_("Content Type"), max_length=300) media_file = models.FileField( - _("Media File"), null=True, blank=True, max_length=300 + _("Media File"), + null=True, + blank=True, + max_length=300, ) media_url = models.TextField(_("Media url"), null=True, blank=True) diff --git a/chats/settings.py b/chats/settings.py index 2531d46e..b68de223 100644 --- a/chats/settings.py +++ b/chats/settings.py @@ -204,8 +204,8 @@ AWS_STORAGE_BUCKET_NAME = env.str("AWS_STORAGE_BUCKET_NAME") - AWS_QUERYSTRING_AUTH = False - AWS_S3_FILE_OVERWRITE = False + AWS_QUERYSTRING_AUTH = env.bool("AWS_QUERYSTRING_AUTH", default=True) + AWS_S3_FILE_OVERWRITE = env.bool("AWS_S3_FILE_OVERWRITE", default=False) else: MEDIA_URL = "/media/"