Overview of environment variables

Environment variables

Magento Enterprise Cloud Edition enables you to create variables in your environment that override configuration options. For example, we strongly recommend you immediately change your Magento Admin URI and administrative user’s password to prevent someone guessing your login and changing settings without your knowledge.

We support the following types of variables:

  • Variables defined by Magento Enterprise Cloud Edition itself and that give you all the context you need about the environment (how to connect to your database, for example).
  • Custom environment variables you define.

Environment variable names must use the characters a-z, A-Z, 0-9, and ., _, :, - only and can be up to 256 characters in length.

Platform variables that are expressed as base64-encoded JSON object can be up to 4KB in size.

Environment variables have an env namespace.

Variables are hierarchical, which means that if a variable is not overridden, it is inherited from the parent environment and is indicated as inherited.

This enables you to define your development variables only once, and use them on all the child environments.

List the current environment variables

To list current environment variables:

  1. Log in to your project using the CLI.
  2. List the projects:

    magento-cloud project:list
    
  3. List environments in the selected project:

    magento-cloud environment:list -p <project id>
    
  4. SSH to the environment:

    magento-cloud environment:ssh -p <project id> -e <environment name>
    
  5. After you’re connected, enter export.

    Variables are base64-encoded JSON objects.

  6. To decode the value of a variable, enter

    echo $<variable name> | base64 --decode
    

    For example,

    echo $MAGENTO_CLOUD_RELATIONSHIPS | base64 --decode