k1LoW / serverless-s3-sync

A plugin to sync local directories and S3 prefixes for Serverless Framework :zap:
183 stars 70 forks source link

Solution for #35 - update Cache-Control headers even if files don't change #39

Closed trilom closed 4 years ago

trilom commented 4 years ago

This PR should resolve #35 this process will ensure metadata is up to date with every s3sync call.

after the s3sync:sync process the s3sync:metadata process follows.

this will take a look at the custom.s3Sync[n].params values, and match the globs based on the configuration of the custom.s3Sync[n] parameters. Once it knows all of the files that have metadata altered by this file, it will perform a s3api call on copy-object, which is nicely wrapped in the @oauth0/s3 lib.

There shouldn't exactly be any issues with using copy-object, one thing to note is that the copy-object api call will explicitly alter the readability of the file. For example, if you call the s3api copy-object on a public-read acl s3 file, and you don't explicitly give it an acl, it will make it private by default. This shouldn't be a problem considering if you are wanting your files to have an alternate acl then you set this in custom.s3Sync[n].acl and the s3sync:metadata will always take this into account.

Please let me know if there are any alterations you need to get this merged, it is a blocker for us and we'd love to not have to point our package.json at some other source.

あけおめ ありがとうございます

trilom commented 4 years ago

@k1LoW please check it when you are free. 🙏

trilom commented 4 years ago

Thank you @k1LoW. I have been stuck on Shinkansen all day, what a busy busy travel day! This should resolve everything you mentioned.

k1LoW commented 4 years ago

@trilom Thank you !!!

k1LoW commented 4 years ago

Released as v1.10.0.