paliarush / magento2-vagrant-for-developers

Vagrant Box for Magento 2 Developers
MIT License
447 stars 165 forks source link

Don't remove app/etc/config.php when installing Magento #155

Closed leoquijano closed 6 years ago

leoquijano commented 7 years ago

Hello,

I'm using Paliarush Vagrant box with a custom Git repo instead of the base Magento Git. This means that the repo will have a set of modules, with the purpose of having Vagrant launch a website will several extensions already installed.

I noticed that in scripts/guest-m-reinstall, the app/etc/config.php is being removed, prior to Magento installation. This means that Magento will regenerate it, overriding any disabled modules or other kinds of versioned information.

status "Removing Magento configuration files (env.php and config.php)"
rm -f "${MAGENTO_ROOT}/app/etc/config.php"
rm -f "${MAGENTO_ROOT}/app/etc/env.php"

I'm aware that app/etc/config.php hasn't been kept in Git by Magento itself, due to some issues they have been having in versions 2.0 and 2.1. However, it looks like they are now officially planning to have this file in Git, and to extend it for more uses:

Another 12 Factor App consideration is to treat configuration as code. It should be under source code version management and propagated as a part of your standard deployment process. For this reason, Magento has formalized that config.php is intended to be committed to git and shared between all environments. env.php overrides settings in config.php and is expected to be local per environment. (Environment variables can also be used to override the env.php file.)

So, in order to prepare for Magento 2.2, and to allow custom Git repos to operate successfully out of the box, I think it would be a good idea to not remove config.php? (or maybe make it configurable?)

paliarush commented 7 years ago

Thank you @leoquijano for raising this question. Starting from Magento 2.2, config.php is not under .gitignore anymore. I believe in general it should still be removed during re-installation.

But it definitely makes sense to make this behavior configurable for scenarios like yours. Would you be able to contribute such change in the form of pull request? Option can be added to the magento section of config.yaml

leoquijano commented 7 years ago

Sure :)

I have to upgrade a website I work on to 2.2, and then I can test a new change and submit the PR.