<p>From the <a href="https://craftcms.com/docs/multi-environment-configs#setting-support" rel="noreferrer">docs</a>, environment variables are currently only parsed in 3 places in the control panel. </p>

<ul>
<li>File System Path (in asset source settings)</li>
<li>URL (in asset source settings)</li>
<li>Site URL (in Settings → General)</li>
</ul>

<p>So they won't work in the "subfolder" setting.  You can add a <a href="https://feedback.craftcms.com" rel="noreferrer">feature request</a> if you think that should change.</p>

CC BY-SA 3.0
2017-09-04T14:08:24.587Z
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
CC BY-SA 3.0
2017-09-04T14:12:57.547Z
Even if I use the full reference folders still get created like {craft.app.config.general.environmentVariables.baseAssetsPath}
Sean Delaney
CC BY-SA 3.0
2017-11-02T21:51:51.177Z
@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](https://github.com/nystudio107/craft3-multi-environment#asset-volumes)
andrew.welch
CC BY-SA 3.0
2016-11-03T22:11:43.517Z
2016-11-03T22:11:43.517Z
Brad Bell
<p><a href="https://i.sstatic.net/Z8Bmp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Z8Bmp.png" alt="Subfolder Environment Variable"></a>
<a href="https://i.sstatic.net/Dt5Zo.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Dt5Zo.png" alt="S3 subfolder"></a></p>

<p>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.</p>

<s3><environmentvariables>
Using Craft environment variable for Asset source subfolder
# Using Craft environment variable for Asset source subfolder

(Asked by: username_0 on 2016-11-03)

[![Subfolder Environment Variable](https://i.sstatic.net/Z8Bmp.png)](https://i.sstatic.net/Z8Bmp.png)
[![S3 subfolder](https://i.sstatic.net/Dt5Zo.png)](https://i.sstatic.net/Dt5Zo.png)

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.

**Tags:** s3, environmentvariables

---

## 1 answers

### Answer by username_1 on 2016-11-03. Score: 5 | Accepted answer

From the [docs](https://craftcms.com/docs/multi-environment-configs#setting-support), 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](https://feedback.craftcms.com) if you think that should change.

> **Comments:**
> **username_2**: 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.  
> **username_2**: Even if I use the full reference folders still get created like {craft.app.config.general.environmentVariables.baseAssetsPath}  
> **username_3**: @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](https://github.com/nystudio107/craft3-multi-environment#asset-volumes)  

---

