Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use config / env vars for asset container disks #1380

@stuartcusackie

Description

@stuartcusackie

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions