Magento 2 Store Configuration Setup
composer install alaa/magento2-store-config php -f bin/magento module:enable Alaa_StoreConfig php -f bin/magento setup:upgrade
you would first run the following command:
php -f bin/magento store-config:dump
The above command will dump the data in the
core_config_data table to the config files. The data will be broken into the following sections:
- The folder
- Deploy mode
developerresulting in paths
- Scopes which will be resulting into:
- Then into default, store-code and website-code such as:
Sensitive Data will not be dumped as setting sensitive data should not be done via version control - click here to find out more about sensitive configurations.
php -f bin/magento store-config:dump will dump the data initially so development can start from that point. Then configurations can be added as needed and thus these configurations can be shared among the team to keep the same configuration across local environments.
The breakdown into development and production modes will help keep the configurations separate in case configurations in production vary from the development environment.
You have to be in production mode to generate configs for the production, however you can create them manually to
Sample configuration file:
<?php declare(strict_types=1); return [ [ 'path' => 'web/seo/use_rewrites', 'value' => '1', ], [ 'path' => 'general/locale/code', 'value' => 'en_GB', ], ];
The configurations for production mode will sit inside
production configurations need to be manually added if you are in developer mode.
Once more configurations are added to the files, they can be checked by the following command:
php -f bin/magento store-config:check
The above will check the files for any missing arguments which are mainly the
path and the
Any sensitive data will be flagged out and will advise to remove them from the configuration files.
Once check is done, add these files to
php -f bin/magento store-config:configure
The above command will write the configurations from the files to the
The configuration will be written based on the deploy mode.
The above command is safe to run as many times.
The recurring script will write the configurations to the
The configurations are deploy mode based.
The module can be configured from the admin:
- Enable/Disable the module functionality
- Enable/Disable loggers (file and/or console loggers)
- Enable/Disable the Recurring scripts
Feel free to raise issues and contribute.