Use a private bucket

This commit is contained in:
byte[] 2022-05-14 13:54:45 -04:00
parent 69ffce8a79
commit 96372ec921
3 changed files with 4 additions and 6 deletions

View file

@ -142,7 +142,7 @@ defmodule Mix.Tasks.UploadToS3 do
{_, mime} = Mime.file(path)
contents = File.read!(path)
S3.put_object(bucket(), uploaded_path, contents, acl: :public_read, content_type: mime)
S3.put_object(bucket(), uploaded_path, contents, content_type: mime)
|> ExAws.request!()
end

View file

@ -23,8 +23,6 @@ defmodule Philomena.Images.Thumbnailer do
tall: {1024, 4096}
]
@acl [acl: :public_read]
def thumbnail_versions do
@versions
end
@ -140,7 +138,7 @@ defmodule Philomena.Images.Thumbnailer do
source = Path.join(source_prefix, name)
target = Path.join(target_prefix, name)
ExAws.request(S3.put_object_copy(bucket(), target, bucket(), source, @acl))
ExAws.request(S3.put_object_copy(bucket(), target, bucket(), source))
ExAws.request(S3.delete_object(bucket(), source))
end)
end

View file

@ -73,11 +73,11 @@ defmodule Philomena.Uploader do
content type and permissions.
"""
def persist_file(path, file) do
{_, mime} = Mime.file(path)
{_, mime} = Mime.file(file)
file
|> S3.Upload.stream_file()
|> S3.upload(bucket(), path, acl: :public_read, content_type: mime)
|> S3.upload(bucket(), path, content_type: mime)
|> ExAws.request!()
end