Skip to content

[4.x] Fs, volumes during testing #14005

Closed Answered by brandonkelly
qrazi asked this question in Q&A
Discussion options

You must be logged in to vote

In Craft 4, you can create separate filesystems for each environment: a Local filesystem for local development, and an S3 filesystem for production. Then, create a new environment variable in .env that is set to the Local filesystem’s handle, e.g.

IMAGES_FS=localImages

Then in your volume’s settings, set its filesystem to that same environment variable name (e.g. $IMAGES_FS). It will then use whatever filesystem the environment variable is referring to. Locally that could be localImages, but on production you could set the same environment variable to s3Images instead.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@qrazi
Comment options

Answer selected by brandonkelly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants