Skip to content

Commit

Permalink
Merge pull request #4065 from freelawproject/feat-add-setting-to-twea…
Browse files Browse the repository at this point in the history
…k-private-storage-bucket

feat(settings): Adds variable to set the private storage bucket name
  • Loading branch information
mlissner committed May 22, 2024
2 parents 758ee85 + 0b69794 commit 7260d54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cl/lib/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import uuid
from typing import Dict, Optional

from django.conf import settings
from django.core.files.storage import Storage
from storages.backends.s3 import S3ManifestStaticStorage, S3Storage

Expand Down Expand Up @@ -104,7 +105,7 @@ class S3PrivateUUIDStorage(S3Storage):
"""

default_acl = "private"
bucket_name = "com-courtlistener-private-storage"
bucket_name = settings.AWS_PRIVATE_STORAGE_BUCKET_NAME
file_overwrite = True

def get_available_name(
Expand Down
6 changes: 6 additions & 0 deletions cl/settings/third_party/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@
AWS_STORAGE_BUCKET_NAME = env(
"AWS_STORAGE_BUCKET_NAME", default="com-courtlistener-storage"
)
AWS_PRIVATE_STORAGE_BUCKET_NAME = env(
"AWS_PRIVATE_STORAGE_BUCKET_NAME",
default="com-courtlistener-private-storage",
)

AWS_S3_CUSTOM_DOMAIN = "storage.courtlistener.com"
AWS_DEFAULT_ACL = "public-read"
AWS_QUERYSTRING_AUTH = False
AWS_S3_MAX_MEMORY_SIZE = 16 * 1024 * 1024

if DEVELOPMENT:
AWS_STORAGE_BUCKET_NAME = "dev-com-courtlistener-storage"
AWS_PRIVATE_STORAGE_BUCKET_NAME = "dev-com-courtlistener-private-storage"
AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com"


Expand Down

0 comments on commit 7260d54

Please sign in to comment.