Configuration Management

Magento stores its deployment configuration in the app/etc/config.php file. This file is designed to be included in version control as the primary configuration source when an active connection to the database is unavailable, as is the case when a build job is being run during a pipeline deployment. The scope and themes configuration sets need to be exported to the config.php file in order for the build to have enough information to complete successfully. The Magento CLI can be used to export the needed configuration by running bin/magento app:config:dump scopes themes

This will result in the configuration being exported, and the altered config.php file will then need to be committed and pushed to Git for use in the next build.

Specifying additional configuration settings to be included in config.php

Additional configuration variables will occasionally need to be available during a build to ensure that the site is deployed correctly. One such occasion is when enabling CSS and JS minification—if this configuration is not present during the build, the minified CSS/JS files will not be compiled and will result in errors on the deployed site. Instructing Magento to include specific configuration keys can be done by using the --lock-config parameter of bin/magento config:set. For example:

bin/magento config:set --lock-config dev/js/minify_files 1 bin/magento config:set --lock-config dev/css/minify_files 1

The above will export the settings to config.php (which should then be checked in to the gitlab repo). Configuration that has been locked in the config.php file will result in the corresponding option being greyed out in the Magento backend.

Related content