Skip to content

Commit

Permalink
Dev: Allow Minio to be used without debug mode (#11272)
Browse files Browse the repository at this point in the history
The rclone setup currently assume that debug mode always implies
using Minio. Allow developers to test with debug mode disabled
by making the S3_PROVIDER explicit.

Set S3_PROVIDER to "AWS" in settings/base.py and "minio" in
settomgs/docker_compose.py

Signed-off-by: Peter Hoyes <peter.hoyes@arm.com>
  • Loading branch information
hoyes committed Apr 15, 2024
1 parent 23330ff commit d486011
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions readthedocs/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,3 +1047,5 @@ def SOCIALACCOUNT_PROVIDERS(self):
"timeout": CACHEOPS_TIMEOUT,
},
}

S3_PROVIDER = "AWS"
1 change: 1 addition & 0 deletions readthedocs/settings/docker_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def DATABASES(self): # noqa
S3_STATIC_STORAGE_BUCKET = "static"
S3_STATIC_STORAGE_OVERRIDE_HOSTNAME = PRODUCTION_DOMAIN
S3_MEDIA_STORAGE_OVERRIDE_HOSTNAME = PRODUCTION_DOMAIN
S3_PROVIDER = "minio"

AWS_S3_ENCRYPTION = False
AWS_S3_SECURE_URLS = False
Expand Down
6 changes: 1 addition & 5 deletions readthedocs/storage/s3_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
class S3BuildMediaStorageMixin(BuildMediaStorageMixin, S3Boto3Storage):
@cached_property
def _rclone(self):
provider = "AWS"
# If a custom endpoint URL is given and
# we are running in DEBUG mode, use minio as provider.
if self.endpoint_url and settings.DEBUG:
provider = "minio"
provider = settings.S3_PROVIDER

return RCloneS3Remote(
bucket_name=self.bucket_name,
Expand Down

0 comments on commit d486011

Please sign in to comment.