1

I'm looking to pull assets from a local folder when developing locally, and an S3 folder when on staging/production.

Is this possible? It looks like no, but I'm hoping that's not the definitive answer: Multi-Environment S3 Asset Paths

It appears you can't alter the asset 'type'. However, I've seen configs (specifically, this one: https://designkarma.co.uk/blog/localization-multi-environment-setup-in-craft) that seem to use different urls for local vs s3 assets. That gets rid of the ability to set a cache duration and other s3 specific options, however.

Is the only real way to do this is to set CORS settings on the S3 folder to allow connections from a local development URL, and use that for local/staging, and another bucket/config for production?

  • 2
    There are a lot of potential issues here. Assets need to be indexed before they can be used and Assets relies on that index. If you make changes to Assets outside of Craft, Craft won't know about those changes. Same if you make changes to Assets on a local Craft install - unless you push the DB as well. So, all of this leads me to this question - what's wrong with just using two different S3 buckets? – Andris Sevcenko Aug 25 '17 at 8:06
2

We created a plugin to help solve this problem: https://github.com/Firstborn/Craft-CMS-Environment-Settings

This plugin allows you to specify different configurations per environment on a single asset source.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.