I wanted to enable some modules only locally, without the possibility to use them on production. This would eliminate a vulnerability of leaking debug data. As an example I will use Magneto Debug module.
To enable a module only locally and keep it turned off anywhere else.
app/etc/modules/Magento_Debug.xmldelete the line<active>true</active>
app/etc/local.xmladd the following lines<modules>
Deleting the line from
app/etc/modules/Magento_Debug.xml is required, because Magento firstly loads
app/etc/local.xml and then overloads its content.