Workflow for Magento 2 settings

I found this treasure hidden in the Magento Github repo describing succinctly on how to work with Magento's configuration files, namely app/etc/config.php and app/etc/env.php. Reposting it here so that I can refer to it back more easily in the future.

In summary app/etc/config.php is shared across all instances but app/etc/env.php only exists individually on each instance. The first is part of your code repository the latter isn't.

Here is Juan Alonso's example of a workflow on a real project:

  1. When creating the project we dump all settings with app:config:dump scopes themes
    That creates the needed settings for scopes and themes but skips system core config data

  2. We also add shared settings needed for PRD and Build environments

    bin/magento config:set --lock-config dev/js/merge_files 1
    bin/magento config:set --lock-config dev/css/merge_css_files 1
    bin/magento config:set --lock-config dev/static/sign 1
  3. As project evolves, we add a new stores and themes, so we need to update our config.php settings. bin/magento app:config:dump scopes themes

  4. At the same time, if we ever need to share system settings on all environments, we can use the command bin/magento config:set --lock-config without needing to dump all hundreds of settings into the config.php
Kristof Ringleff

Kristof Ringleff

Founder and Lead Developer at Fooman

Join the Fooman Community

We send our popular Fooman Developer Monthly email with Magento news, articles & developer tips, as well as occasional Fooman extension updates.