Magento 2.1.18 is the final 2.1.x release. After June 2019, Magento 2.1.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

Cloud variables

Environment variables that are specific to Magento Commerce Cloud use the MAGENTO_CLOUD_* prefix:

Variable Description
MAGENTO_CLOUD_APP_DIR The absolute path to the application directory.
MAGENTO_CLOUD_APPLICATION A base64-encoded JSON object that describes the application. It maps to the .magento.app.yaml file content and has subkeys.
MAGENTO_CLOUD_APPLICATION_NAME The name of the application configured in the .magento.app.yaml file.
MAGENTO_CLOUD_DOCUMENT_ROOT The absolute path to the web document root, if applicable.
MAGENTO_CLOUD_ENVIRONMENT The name of the environment branch.
MAGENTO_CLOUD_PROJECT The project ID.
MAGENTO_CLOUD_RELATIONSHIPS A base64-encoded JSON object that represents key (relationship name) and value (arrays of relationship pairs) endpoint definition. Each relationship endpoint definition is a decomposed form of a URL. It has a scheme, a host, a port, and optionally a username, password, path and some additional information in query.
MAGENTO_CLOUD_ROUTES Describe the routes defined in the environment .magento/routes.yaml file.
MAGENTO_CLOUD_TREE_ID The tree ID for the application, which corresponds to the SHA of the tree in Git.
MAGENTO_CLOUD_VARIABLES A base64-encoded JSON object with key-value pairs, such as "key":"value".

To add environment variables to override configuration settings using the Project Web Interface, you must prepend the variable name with env: as in the following example. Environment variable example

Since values can change over time, it is best to inspect the variable at runtime and use it to configure your application. For example, we use the MAGENTO_CLOUD_RELATIONSHIPS variable to retrieve environment-related relationships as follows:

1
2
3
4
5
6
7
8
9
/**
  * Get relationships information from MagentoCloud environment variable.
  *
  * @return mixed
  */
    protected function getRelationships()
    {
        return json_decode(base64_decode($_ENV["MAGENTO_CLOUD_RELATIONSHIPS"]), true);
    }

To view environment variables:

You can use the env:config:show command from the ece-tools package to show a list of variables for the current environment.

1
php ./vendor/bin/ece-tools env:config:show variables

Sample output for the variables option:

1
2
3
4
5
6
7
Magento Cloud Environment Variables:
+-----------------------------------+----------------------------------+
| Variable name                     | Value                            |
+-----------------------------------+----------------------------------+
| ADMIN_EMAIL                       | magentoadmin@company.com         |
| ADMIN_PASSWORD                    | 123123q                          |
+-----------------------------------+----------------------------------+
Updated