Skip to content

Commit

Permalink
Merge pull request #1016 from thunderstore-io/storage-config
Browse files Browse the repository at this point in the history
Add granular config options for storage mirroring
  • Loading branch information
MythicManiac authored Mar 3, 2024
2 parents e0ab3ee + 5adc34b commit 279e50c
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions django/thunderstore/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@
SHOW_CYBERSTORM_API_DOCS=(bool, False),
USE_ASYNC_PACKAGE_SUBMISSION_FLOW=(bool, False),
USE_TIME_SERIES_PACKAGE_DOWNLOAD_METRICS=(bool, True),
MIRROR_DEFAULT_STORAGE=(bool, True),
MIRROR_THUMBNAIL_STORAGE=(bool, True),
MIRROR_PACKAGE_STORAGE=(bool, True),
MIRROR_MODPACK_STORAGE=(bool, True),
MIRROR_SCHEMA_STORAGE=(bool, True),
MIRROR_BLOB_STORAGE=(bool, True),
)

ALWAYS_RAISE_EXCEPTIONS = env.bool("ALWAYS_RAISE_EXCEPTIONS")
Expand Down Expand Up @@ -706,12 +712,19 @@ def get_redis_cache(env_key: str, fallback_key: Optional[str] = None):
},
)
S3_MIRRORS = S3_MIRRORS + mirror
DEFAULT_FILE_STORAGE = "thunderstore.core.storage.MirroredS3Storage"
THUMBNAIL_DEFAULT_STORAGE = "thunderstore.core.storage.MirroredS3Storage"
PACKAGE_FILE_STORAGE = "thunderstore.core.storage.MirroredS3Storage"
MODPACK_FILE_STORAGE = "thunderstore.core.storage.MirroredS3Storage"
SCHEMA_FILE_STORAGE = "thunderstore.core.storage.MirroredS3Storage"
BLOB_FILE_STORAGE = "thunderstore.core.storage.MirroredS3Storage"

if env.bool("MIRROR_DEFAULT_STORAGE"):
DEFAULT_FILE_STORAGE = "thunderstore.core.storage.MirroredS3Storage"
if env.bool("MIRROR_THUMBNAIL_STORAGE"):
THUMBNAIL_DEFAULT_STORAGE = "thunderstore.core.storage.MirroredS3Storage"
if env.bool("MIRROR_PACKAGE_STORAGE"):
PACKAGE_FILE_STORAGE = "thunderstore.core.storage.MirroredS3Storage"
if env.bool("MIRROR_MODPACK_STORAGE"):
MODPACK_FILE_STORAGE = "thunderstore.core.storage.MirroredS3Storage"
if env.bool("MIRROR_SCHEMA_STORAGE"):
SCHEMA_FILE_STORAGE = "thunderstore.core.storage.MirroredS3Storage"
if env.bool("MIRROR_BLOB_STORAGE"):
BLOB_FILE_STORAGE = "thunderstore.core.storage.MirroredS3Storage"

ALLOWED_CDNS = env.list("ALLOWED_CDNS")

Expand Down

0 comments on commit 279e50c

Please sign in to comment.