Magento Commerce (Cloud) environment variables
Environment variables that are specific to Magento Commerce (Cloud) are prefixed with
- 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 the content of the
.magento.app.yamlthat you have in Git and it has a few subkeys.
- MAGENTO_CLOUD_APPLICATION_NAME: The name of the application, as configured
- MAGENTO_CLOUD_DOCUMENT_ROOT: The absolute path to the web document root, if applicable.
- MAGENTO_CLOUD_ENVIRONMENT: The name of the environment (that is, the name of the branch in Git).
- MAGENTO_CLOUD_PROJECT: The ID of the project.
- MAGENTO_CLOUD_RELATIONSHIPS: A base64-encoded JSON object whose keys
are the relationship name and the values are arrays of relationship
endpoint definitions. Each relationship endpoint definition is a
decomposed form of a URL. It has a
port, and optionally a
pathand some additional information in
- MAGENTO_CLOUD_ROUTES: Describe the routes that you defined in the
environment. It maps the content of the
- MAGENTO_CLOUD_TREE_ID: The ID of the tree the application was built from. It’s essentially the SHA of the tree in Git.
- MAGENTO_CLOUD_VARIABLES: A base64-encoded JSON object which keys are variables names and values are variable values (a string).
Since values can change over time, you should 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: