<p>Environmental variables as such don't exist "as a thing" in Craft 3. Instead, you'd define your Volumes in the AdminCP and override anything you need in <code>craft/config/volumes.php</code></p>

<p>You can see an example of how to do it here: <a href="https://github.com/nystudio107/craft3-multi-environment" rel="nofollow noreferrer">Craft 3 Multi-Environment</a></p>

CC BY-SA 3.0
2017-09-04T15:01:56.707Z
Where in the Craft docs does it say to use `volumes.php` other than https://github.com/nystudio107/craft3-multi-environment ?
Sean Delaney
CC BY-SA 3.0
2017-09-04T15:03:24.023Z
Nevermind, I found it - https://github.com/craftcms/docs/blob/master/en/configuration.md
Sean Delaney
CC BY-SA 3.0
2017-09-04T15:06:32.067Z
Thank you for pointing me in the right direction. I guess I should read Craft 3 docs a few more times as I've obviously missed/forgotten some important changes.
Sean Delaney
CC BY-SA 4.0
2020-01-26T23:54:42.993Z
The link https://github.com/craftcms/docs/blob/master/en/configuration.md appears to be dead.
David Rhoden
CC BY-SA 3.0
2017-09-04T14:50:30.717Z
2017-09-04T14:50:30.717Z
andrew.welch
<p>I'm using Craft 3 and I have 2 Sites setup.</p>

<p>In my <code>config/general.php</code> file I have:</p>

<pre><code>return [
    '*' =&gt; [
        'environmentVariables' =&gt; [
            'baseAssetsUrl' =&gt; '//'.strtolower($_SERVER['SERVER_NAME']).'/assets/',
            'baseAssetsPath' =&gt; realpath(dirname(__FILE__)).'/../web/assets',
        ],
    ],

    'craft3uk.dev' =&gt; [
        'timezone' =&gt; 'Europe/London',
        'siteUrl' =&gt; 'http://www.craft3uk.dev/',
    ],

    'craft3me.dev' =&gt; [
        'timezone' =&gt; 'Asia/Dubai',
        'siteUrl' =&gt; 'http://www.craft3me.dev/',
    ],

    'dev' =&gt; [
        'devMode' =&gt; true,
    ],

    'staging' =&gt; [
    ],

    'production' =&gt; [
    ],
];
</code></pre>

<p>I can access the variables fine in a template like:</p>

<pre><code>{% set baseAssetsUrl = craft.app.config.general.environmentVariables.baseAssetsUrl %}
{% set baseUploadsUrl = craft.app.config.general.environmentVariables.baseUploadsUrl %}
</code></pre>

<p>But when I try using <code>{baseAssetsPath}</code> like this</p>

<p><a href="https://i.sstatic.net/pyFkX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pyFkX.png" alt="enter image description here"></a></p>

<p>I get:</p>

<p><a href="https://i.sstatic.net/vG78I.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vG78I.png" alt="enter image description here"></a></p>

<p>I'm a bit confused as I have a Craft 2 site setup the exact same way and this works fine. </p>

<p>I cannot see anything in the Craft 3 docs regarding this either?</p>

<p>Can anyone help me out please?</p>

<assets><multi-environment><environmentvariables>
Craft 3: Environment variables are not parsed when used in Assets source field
# Craft 3: Environment variables are not parsed when used in Assets source field

(Asked by: username_0 on 2017-09-04)

I'm using Craft 3 and I have 2 Sites setup.
In my config/general.php file I have:
return [
    '*' => [
        'environmentVariables' => [
            'baseAssetsUrl' => '//'.strtolower($_SERVER['SERVER_NAME']).'/assets/',
            'baseAssetsPath' => realpath(dirname(__FILE__)).'/../web/assets',
        ],
    ],

    'craft3uk.dev' => [
        'timezone' => 'Europe/London',
        'siteUrl' => 'http://www.craft3uk.dev/',
    ],

    'craft3me.dev' => [
        'timezone' => 'Asia/Dubai',
        'siteUrl' => 'http://www.craft3me.dev/',
    ],

    'dev' => [
        'devMode' => true,
    ],

    'staging' => [
    ],

    'production' => [
    ],
];

I can access the variables fine in a template like:
{% set baseAssetsUrl = craft.app.config.general.environmentVariables.baseAssetsUrl %}
{% set baseUploadsUrl = craft.app.config.general.environmentVariables.baseUploadsUrl %}

But when I try using {baseAssetsPath} like this

I get:

I'm a bit confused as I have a Craft 2 site setup the exact same way and this works fine. 
I cannot see anything in the Craft 3 docs regarding this either?
Can anyone help me out please?

**Tags:** assets, multi-environment, environmentvariables

---

## 1 answers

### Answer by username_1 on 2017-09-04. Score: 3 | Accepted answer

Environmental variables as such don't exist "as a thing" in Craft 3. Instead, you'd define your Volumes in the AdminCP and override anything you need in `craft/config/volumes.php`

You can see an example of how to do it here: [Craft 3 Multi-Environment](https://github.com/nystudio107/craft3-multi-environment)

> **Comments:**
> **username_0**: Where in the Craft docs does it say to use `volumes.php` other than https://github.com/nystudio107/craft3-multi-environment ?  
> **username_0**: Nevermind, I found it - https://github.com/craftcms/docs/blob/master/en/configuration.md  
> **username_0**: Thank you for pointing me in the right direction. I guess I should read Craft 3 docs a few more times as I've obviously missed/forgotten some important changes.  
> **username_2**: The link https://github.com/craftcms/docs/blob/master/en/configuration.md appears to be dead.  

---

