[4.x] Fs, volumes during testing #14005
-
Background: I'm finally getting round to upgrading a rather large and customized multisite Craft install to 4.x. We have, also devs, our volumes all configured to S3 buckets, since there are several GBs of assets that we want to use also in dev and staging environments. For running Codeception tests in in 3.x, I "abuse" our AssetFixture class's Now my question; how can I achieve this in Craft 4? How can I isolate the location of assets for test runs? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
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 IMAGES_FS=localImages Then in your volume’s settings, set its filesystem to that same environment variable name (e.g. |
Beta Was this translation helpful? Give feedback.
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.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 belocalImages
, but on production you could set the same environment variable tos3Images
instead.