5

Subfolder Environment Variable S3 subfolder

I have an environment variable "bucketUrl" that I would like to use as the subfolder path in my S3 bucket. However, Craft is not parsing the variable. When I upload an image, I see in my S3 bucket that a new subfolder "{bucketUrl}" was created with the uploaded image inside it. Why is Craft not parsing the environment variable? Craft is parsing my site url variable I am using elsewhere in the Craft admin, so I'm not sure why Craft is not parsing the bucket url variable.

4

From the docs, environment variables are currently only parsed in 3 places in the control panel.

  • File System Path (in asset source settings)
  • URL (in asset source settings)
  • Site URL (in Settings → General)

So they won't work in the "subfolder" setting. You can add a feature request if you think that should change.

  • I'm having a similar issue but on Craft 3 - folder name is called {baseAssetsPath} instead of getting parsed. I have the same setup but using Craft 2 site and that is working fine. – Sean Delaney Sep 4 '17 at 14:08
  • Even if I use the full reference folders still get created like {craft.app.config.general.environmentVariables.baseAssetsPath} – Sean Delaney Sep 4 '17 at 14:12
  • @SeanDelaney environmentalVariables have gone away with Craft 3; instead you can put multi-environment things like this into your volumes.php config file. There's an example of that here: Craft3-Multi-Environment – andrew.welch Nov 2 '17 at 21:51

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.