Simple way to serve a folder of static assets in the cloud, and update it or remove it all later #1459
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.
"Efficiently sync a local folder of static files to uploadfs,
with the ability to remove the folder and its contents later.
This ensures your application will still work if you move
it to s3, azure blob storage, etc. via uploadfs.
It is meant for delivering the output of tools like backstop,
sitemap generators, etc. that generate output as HTML files
and associated assets.
As long as you use this module, you won't have to worry about
making changes to those tools on the day you switch to S3."
apos.cloudStatic.syncFolder('/local-folder', '/uploadfs/folder')
--> pushes it up, replacing folder’s contents efficiently if it existsapos.cloudStatic.removeFolder('/uploadfs-folder')
--> gets rid of one of these folders when you’re done with itvar url = apos.cloudStatic.getUrl('/uploadfs-folder')
I think I've limited the scope properly here, and keeping it inside Apostrophe reflects that this is a utility module for us that makes sense given what Apostrophe has on hand, not something more cosmic in scope.