Environment variables

Adobe Commerce on cloud infrastructure enables you to assign environment variables to override configuration options. The ece-tools package sets values in the env.php file based on values from Cloud variables, variables set in the Cloud Console, and the .magento.env.yaml configuration file.

The environment variables in the .magento.env.yaml file customize the Cloud environment by overriding your existing Commerce configuration. If a default value is Not Set, then the ece-tools package takes NO action and uses the Commerce default or the value from the MAGENTO_CLOUD_RELATIONSHIPS configuration. If the default value is set, then the ece-tools package acts to set that default.

The types of environment variables include:

  • ADMIN—variables override project ADMIN variables

  • MAGENTO_CLOUD—variables specific to cloud infrastructure

  • Variables used in the .magento.env.yaml file:

    • Global—variables affect build, deploy, and post-deploy stages
    • Build—variables control build actions
    • Deploy—variables control deploy actions
    • Post-deploy—variables control actions after deploy

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

You can set ADMIN variables from the Cloud Console or using the Adobe Commerce CLI. You can manage other environment variables from the .magento.env.yaml file to manage build-and-deploy actions across all of your environments—including Pro Staging and Production—without requiring a support ticket.

YAML files are case sensitive and do not allow tabs. Be careful to use consistent indentation throughout the .magento.env.yaml file or your configuration may not work as expected. The examples in this documentation and in the sample file use two-space indentation. Use the ece-tools validate command to check your configuration.