Magento2 – Should app/etc/config.php Be in VCS?

configurationdeploygitmagento2

I have a question related with file app/etc/config.php.

This file described here and defined:

Magento base dir/app/etc/config.php, which contains the list of installed modules, themes, and language packages.

Is like app/etc/modules/* in Magento 1 (Normally I have these files in VCS).

But in Magento 2 is recommended not share in VCS (Official .gitignore).

I have some question or uses cases for share in VCS but I want Understand because is not recommend add in VCS

  1. Production Enviroment (With Deploy System Capistrano/Deployer, etc)
    • You make a new deployment… and you need enable new/s module/s php bin/magento module:enable VendorName_NewModule before setup:upgrade
      • How you manage this situation?
    • You make a new deployment and you need disable (for any situation) new/s module/s php bin/magento module:disable VendorName_NewModule before setup:upgrade
      • How you manage this situation?
  2. Local Enviroment

    • If you do not want your team to have a particular module/s enabled/disabled
      • How you manage this situation?
  3. Staging Enviroment

    • How can you achieve a same configuration of production enabled/disabled modules if you don't share app/etc/config.php
      • How you manage this situation? You need make manually?

What is your point of view or how you manage these situations?

Thanks

* VCS : Version Control System, e.g: git, svn, etc

Best Answer

There's nothing wrong with including config.php in VCS if your needs are based on configuration being the same across various environments, especially the on/off states of your modules. The side effect of doing this is the limitation you impose on yourself in terms of having the same themes, language packs, etc on each one as well.

For Magento 2.2 we're going to be making some improvements to add more flexibility to configuration management to support various deployment workflows. You'll have a file that is meant to contain all shared configuration app/etc/config.php (meant for config that's likely to be the same across all environments and kept in VCS). You'll have another file that's meant to contain system-specific configuration app/etc/env.php (meant to contain config that is likely to be different across dev, staging, and production systems).

In the meantime, we've curated some deployment approaches from the community that you can find on this page in case it helps.

Related Topic