silverstripe / silverstripe-s3

Silverstripe module to store assets in S3 rather than on the local filesystem (SS4/SS5 only)
BSD 3-Clause "New" or "Revised" License
20 stars 25 forks source link

Allow assets stored in a subfolder of a bucket #3

Closed sminnee closed 7 years ago

sminnee commented 7 years ago

Assets might not be stored in a bucket root; they may be in an arbitrary subfolder of a bucket.

More generally, it would be useful if an appropriate AWS service object could be scaffolded by Injector and then passed into your filesystem adaptors, rather than needing new env vars for every bit of config that may be necessary.

Ideally, the env vars could be loaded into a yaml config and used to build that service. Direct access to env vars works for come config (specifically configuration related to Injector parameters) but we're looking at rolling it out more widely in alpha7 or beta1.

madmatt commented 7 years ago

Ah yep, so you'd like the ability to specify an optional additional prefix (e.g. public/ becomes site-name/public?

The AwsS3Adapter already has the concept of a 'path prefix' which I use to distinguish public vs. protected files, so that would be easy to accommodate.

Makes sense to specify these things by YML rather than direct env vars if possible, I'll look into that sometime :)

sminnee commented 7 years ago

This works like this:

AWS_PROTECTED_BUCKET_PREFIX="sminnee/protected"
AWS_PUBLIC_BUCKET_PREFIX="sminnee/public"