Tune cloud storage upload params and tidy settings #14711
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changeset slightly refactors the ordering of some of our settings related to storage, to help reduce the risk of misintepretation -- having
STORAGES
tweaked way after they are initially defined in the file was a potential future footgun.Also, this changeset starts to use
MEDIA_URL
(which is defined in the k8s setup to point to the assets bucket) for serving images that have been uploaded via the CMS via the CDN. This will mean uploaded images will come from, say,www.mozilla.org/media
avoiding potential cookie-related issues.We also make sure that images uploaded into the storage bucket go into a separate dir that won't clash with anything copied over from Bedrock's hard-coded assets, and now have a filepath that makes it obvious they are custom uploads.
Finally, I also checked whether forms that use file uploads (eg legal trademarks form) will be affected by us changing
STORAGES["default"]
to point to a cloud bucket. It's a non-issue: such files don't get put into permanent storage, and instead are held as temporary files in memory or spooled to/tmp/
(docs)