Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Site's logo management via AWS S3 adapter #169

Merged
merged 7 commits into from
Dec 16, 2016

Conversation

danguita
Copy link
Contributor

@danguita danguita commented Dec 16, 2016

Connects to #109.

Release notes

Releasing this one depends on #170.

What does this PR do?

This PR introduces a small library to abstract file upload operations, and integrates it into the Admin's Site management Form object to allow attaching a file from the UI and storing the public_url returned by the adapter.

The first and only available adapter is AWS S3, which needs to be configured via environment variables, as usual. These environment vars are needed at the time being:

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=eu-west-1
S3_BUCKET_NAME=gobierto-dev

Once the S3 bucket is available and the AWS credentials are reachable from the app instance, an upload process will be performed every time the User submits a new file. All files are kept from now in a UUID format file names:

screen shot 2016-12-16 at 11 50 50

How should this be manually tested?

Get into a Site edit view within the Admin namespace, and submit a new logo in the file field. In the next GET request, the new logo should be shown right above the file field is rendered:

screen shot 2016-12-16 at 12 05 04

foot_markup: HTML de Peu
foot_markup: HTML de Enllaços
google_analytics_id: Codi de Google Analytics
logo_file: Logotip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Molt bé!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was easy! 😛

@ferblape
Copy link
Member

👍 Thank you David!

Files were not visible in my bucket, I guess we needed to enforce the ACL of the object.

@ferblape ferblape merged commit 3ce8e3b into master Dec 16, 2016
@ferblape ferblape deleted the 109-admin-site-logo-management branch December 16, 2016 17:54
@danguita
Copy link
Contributor Author

danguita commented Dec 16, 2016

@ferblape No prob! Did you set the policy in #170 at bucket level? It worked fine for me.

@ferblape
Copy link
Member

Ups, you are right! I'll take care.

@danguita
Copy link
Contributor Author

danguita commented Dec 16, 2016

My fault, I should have mentioned you there! If the policy does the job, I'd avoid passing the ACL param in FileUploader::S3 so that the library stays agnostic.

@ferblape
Copy link
Member

ferblape commented Dec 16, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants