Skip to content

Commit

Permalink
fix: 169 - get uploader working on test (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim738745 authored Feb 28, 2024
1 parent d4aed6d commit fa79229
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions django/api/services/minio.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,31 @@
)


def get_refined_object_name(object_name):
prefix = settings.MINIO_PREFIX
if prefix:
return prefix + '/' + object_name
return object_name


def minio_get_object(object_name):
return MINIO.presigned_get_object(
bucket_name=settings.MINIO_BUCKET_NAME,
object_name=object_name,
object_name=get_refined_object_name(object_name),
expires=timedelta(seconds=3600)
)


def minio_put_object(object_name):
return MINIO.presigned_put_object(
bucket_name=settings.MINIO_BUCKET_NAME,
object_name=object_name,
object_name=get_refined_object_name(object_name),
expires=timedelta(seconds=7200)
)


def minio_remove_object(object_name):
return MINIO.remove_object(
bucket_name=settings.MINIO_BUCKET_NAME,
object_name=object_name
object_name=get_refined_object_name(object_name),
)
1 change: 1 addition & 0 deletions django/api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
MINIO_USE_SSL = bool(
os.getenv('MINIO_USE_SSL', 'False').lower() in ['true', 1]
)
MINIO_PREFIX = os.getenv('MINIO_PREFIX')


DECODER_ACCESS_KEY = os.getenv('DECODER_ACCESS_KEY')
Expand Down

0 comments on commit fa79229

Please sign in to comment.