Type
magento2-module
Import/Export core_config_data values in Magento 2
magento2-module
OSL-3.0
None
None
None
None
None
This extension provides CLI commands for Magento 2 to import/export system configuration data.
While Magento 2 offers the app:config:dump
/ app:config:import
commands, they're limited to one environment and a little bit hard to manage, especially in CI/CD setups.
This extension supports managing configuration values for multiple environments (production, staging, etc.) out-of-the-box, defining and overwriting base configuration values in a specific environment. It also allows different file formats (e.g., YAML, JSON). In general, it makes that process a bit more streamlined and easier to manage, with the added benefit of generalization and cross-compatibility with other agencies/merchants using this.
Add the package to your composer.json
composer require semaio/magento2-configimportexport
Enable and install the module
php bin/magento module:enable Semaio_ConfigImportExport
php bin/magento setup:upgrade
This module is a work in progress and will be extended in the future with more functionality and support for other file formats.
This module currently supports the following file formats:
See docs/file-formats.md for more information and examples.
See docs/config-import.md for more information.
See docs/config-export.md for more information.
When using a push approach in CI/CD, the environment variables should be replaced on the runner and not on the initiating host or target host. For this, you can use this Deployer task to do this and import the config settings;
task('magento:config:set', function () {
$resolver = new \Semaio\ConfigImportExport\Model\Resolver\EnvironmentVariableResolver();
$glob = glob('config/store/**/*.yaml');
array_walk($glob, function ($file) use ($resolver) {
if (file_put_contents($tempFile = tempnam('/tmp', get('clientslug')), $resolver->resolveValue(file_get_contents($file)))) {
upload($tempFile, get('release_path') . '/' . $file);
}
});
run('{{bin/php}} {{release_path}}/bin/magento config:data:import {{release_path}}/config/store ' . get('environment'));
});
If you encounter any problems or bugs, please create an issue on GitHub.
Any contribution to the development of MageSetup is highly welcome. The best possibility to provide any code is to open a pull request on GitHub.
Open Software License (OSL 3.0)
Thanks to all contributors who invested their valuable time to contribute to this module. Much appreciated!
This module is inspired by the awesome n98-magerun plugin "HarrisStreet ImpEx" by @SchumacherFM for Magento 1 which you can find here.
(c) 2016-2022 semaio GmbH / Rouven Alexander Rieker