.magento.env.yaml file uses environment variables to centralize the management of build and deploy actions across all of your environments, including Pro Staging and Production. To configure unique actions in each environment, you must modify this file in each environment.
.magento.env.yaml file includes the following sections:
stage—Accommodates the following stages of deployment:
global—Controls actions in both the build, deploy, and post-deploy phases. You can override these settings in the build, deploy, and post-deploy sections.
build—Controls actions in the build phase only. If you do not specify settings in this section, the build phase uses settings from the global section.
deploy—Controls actions in the deploy phase only. If you do not specify settings in this section, the deploy phase uses settings from the global section.
post-deploy—Controls actions after deploying your application and after the container begins accepting connections.
log—Controls notifications, including notification types and level of detail.
slack—Configure a message to send to a Slack bot.
- logging handlers—Configure hardware and software application messages sent to a remote logging server.
The latest sample of the
.magento.env.yaml file contains a detailed definition for all variables described in the following reference topics:
- Application—variables control administrative credentials
- Global—variables control actions in the following stages:
Constant parsing does not work when using a
symfony/yaml package version earlier than 3.2.
You can use PHP constants in
.magento.env.yaml file definitions instead of hard-coding values. The following example defines the
driver_ options using a PHP constant:
1 2 3 4 5 6 7 8 9 10 11 stage: deploy: DATABASE_CONFIGURATION: connection: default: driver_options: !php/const:\PDO::MYSQL_ATTR_LOCAL_INFILE : 1 indexer: driver_options: !php/const:\PDO::MYSQL_ATTR_LOCAL_INFILE : 1 _merge: true
When a failure occurs because of an unexpected value in the
.magento.env.yaml configuration file, you receive an error message. For example, the following error message presents a list of suggested changes to each item with an unexpected value, in some cases providing valid options:
1 2 3 4 5 6 7 8 - Environment configuration is not valid. Please correct .magento.env.yaml file with next suggestions: Item CRON_CONSUMERS_RUNNER is not supposed to be in stage build. Please move it to one of possible stages: global, deploy Item SKIP_SCD has unexpected type string. Please use one of next types: boolean Item VERBOSE_COMMANDS has unexpected type boolean. Please use one of next types: string Item SKIP_HTML_MINIFICATION has unexpected type string. Please use one of next types: boolean Item CRON_CONSUMERS_RUNNER has unexpected type boolean. Please use one of next types: array Item VAR_WARM_UP_PAGES is not allowed in configuration. Item WARM_UP_PAGES has unexpected type string. Please use one of next types: array
Make any corrections, commit, and push the changes. If you do not receive an error message, then the changes to your configuration file pass the validation.