PRX / publish.prx.org

Dovetail podcast CMS frontend
https://publish.prx.org
GNU Affero General Public License v3.0
2 stars 2 forks source link

Update Evaporate configuration #730

Closed farski closed 3 years ago

farski commented 3 years ago

Based on some of the information I found while working on these two tickets, I think there are some changes that could be made to the env configuration used by Evaporate.

Currently, the relevant settings are:

USE_CLOUDFRONT=true
AWS_URL=https://dsn15xxxxxxx.cloudfront.net
BUCKET_ACCELERATION=true

Based on my reading of the Evaporate [docs](https://github.com/TTLabs/EvaporateJS/wiki/Evaporate.create()), the cloudfront and s3Acceleration options exist only to influence the automatic creation of the URL that it eventually tries to OPTIONS/PUT/POST/etc to.

With the current settings, it's generating URLS like: https://prx-up.s3-accelerate.amazonaws.com/prod/8583b674…

Evaporate is creating virtual host-style URLs because s3Acceleration is enabled. Having cloudfront set to true also would do that, but acceleration takes precedence.

All that being said, there's no way to have it create IPv6-friendly URLs without explicitly providing an aws_url value. I think we should support that by using an aws_url like https://prx-up.s3-accelerate.dualstack.amazonaws.com. It sounds like even when you do this, you still need to keep cloudfront explicitly set to true, to prevent the bucket name from being added to the path.

The s3Acceleration option becomes unnecessary when using an explicit aws_url, as they are mutually exclusive.

I would also suggest that the env vars be renamed to include some hint that they are applying to evaporate or uploads. AWS_URL and USE_CLOUDFRONT are quite ambiguous, especially when the app does other things with AWS and CloudFront.

I can't find anywhere in Publish or Styleguide (where a lot of evaporate functionality originates) where there current USE_CLOUDFRONT or AWS_URL values are even being used.