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

enter image description here

I get:

enter image description here

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?

up vote 3 down vote accepted

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.