Skip to content

Commit

Permalink
add s3 prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienGasser committed Jun 1, 2020
1 parent f6c6400 commit f7b6e91
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/substrapp/tasks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
ACCESS_KEY = os.getenv('BUCKET_TRANSFER_ID')
SECRET_KEY = os.getenv('BUCKET_TRANSFER_SECRET')
BUCKET_NAME = os.getenv('BUCKET_TRANSFER_NAME')
S3_PREFIX = os.getenv('BUCKET_TRANSFER_PREFIX')


class TasksError(Exception):
Expand Down Expand Up @@ -886,7 +887,7 @@ def transfer_to_bucket(tuple_key, paths):
's3',
aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET_KEY)
s3.upload_file(tar_path, BUCKET_NAME, tar_name)
s3.upload_file(tar_path, BUCKET_NAME, f'{S3_PREFIX}{tar_name}' if S3_PREFIX else tar_name)


@timeit
Expand Down

0 comments on commit f7b6e91

Please sign in to comment.