ideas icon indicating copy to clipboard operation
ideas copied to clipboard

Use config / env vars for asset container disks

Open stuartcusackie opened this issue 2 months ago • 1 comments

I use remote storage for asset container disks, e.g.:

// content/assets/images.yaml
title: Images
disk: do_spaces_images

I want to use local storage when developing as it's much faster on image heavy websites. I can easily sync my remote storage to local and change the disk on my asset folder like so:

// content/assets/images.yaml
title: Images
disk: public_images

This is fine but there is a risk here that I will forget to change the 'disk' back to remote storage after development, and if I do forget then it breaks the website. This is all handled safely in Laravel using environment variables but I can't think of a way to do that in Statamic.

Ideally I would have something in my ENV file like:

IMAGES_DISK='public_images'

Google Gemini seems to be hallucinating when it says that this is possible in YAML like so:

// Method 1 (doesn't work)
disk: '{{ get_env:IMAGES_DISK}}'
// Method 2 (doesn't work)
disk: $IMAGES_DISK

So is there a way to use config variables for asset container disks and if not can a method be added?

stuartcusackie avatar Oct 29 '25 10:10 stuartcusackie