mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-12 09:06:44 +01:00
Use a private bucket
This commit is contained in:
parent
69ffce8a79
commit
96372ec921
3 changed files with 4 additions and 6 deletions
|
@ -142,7 +142,7 @@ defmodule Mix.Tasks.UploadToS3 do
|
||||||
{_, mime} = Mime.file(path)
|
{_, mime} = Mime.file(path)
|
||||||
contents = File.read!(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!()
|
|> ExAws.request!()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@ defmodule Philomena.Images.Thumbnailer do
|
||||||
tall: {1024, 4096}
|
tall: {1024, 4096}
|
||||||
]
|
]
|
||||||
|
|
||||||
@acl [acl: :public_read]
|
|
||||||
|
|
||||||
def thumbnail_versions do
|
def thumbnail_versions do
|
||||||
@versions
|
@versions
|
||||||
end
|
end
|
||||||
|
@ -140,7 +138,7 @@ defmodule Philomena.Images.Thumbnailer do
|
||||||
source = Path.join(source_prefix, name)
|
source = Path.join(source_prefix, name)
|
||||||
target = Path.join(target_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))
|
ExAws.request(S3.delete_object(bucket(), source))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,11 +73,11 @@ defmodule Philomena.Uploader do
|
||||||
content type and permissions.
|
content type and permissions.
|
||||||
"""
|
"""
|
||||||
def persist_file(path, file) do
|
def persist_file(path, file) do
|
||||||
{_, mime} = Mime.file(path)
|
{_, mime} = Mime.file(file)
|
||||||
|
|
||||||
file
|
file
|
||||||
|> S3.Upload.stream_file()
|
|> S3.Upload.stream_file()
|
||||||
|> S3.upload(bucket(), path, acl: :public_read, content_type: mime)
|
|> S3.upload(bucket(), path, content_type: mime)
|
||||||
|> ExAws.request!()
|
|> ExAws.request!()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue