I've dumped all the Magento configs with php bin/magento app:config:dump. All the configs are in env.php and config.php now. I've committed the config.php to version control.

My question is: How can I move settings from config.php to env.php? Is there a CLI command for this?

For example; my sphinx IP address is now in config.php, this causes problems because our staging env has a different IP address then our production env. So this setting should not be shared (and therefore should not be in config.php).

What's the best way to solve this problem? I'm using Magento 2.2.3.

1 Answer 1


You have to set your values as either sensitive or system-specific.

Insert into your custom modules di.xml:

<type name="Magento\Config\Model\Config\TypePool">
      <argument name="environment" xsi:type="array">
         <item name="catalog/search/searchengine/port" xsi:type="string">1</item>

Source: https://devdocs.magento.com/guides/v2.2/extension-dev-guide/configuration/sensitive-and-environment-settings.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.