Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/semaio/Magento2-ConfigImportExport
Import/Export configuration data in Magento 2 via CLI.
https://github.com/semaio/Magento2-ConfigImportExport
Last synced: 10 days ago
JSON representation
Import/Export configuration data in Magento 2 via CLI.
- Host: GitHub
- URL: https://github.com/semaio/Magento2-ConfigImportExport
- Owner: semaio
- License: osl-3.0
- Created: 2015-10-25T13:54:58.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2024-08-28T23:02:13.000Z (3 months ago)
- Last Synced: 2024-09-30T18:18:57.339Z (about 1 month ago)
- Language: PHP
- Size: 231 KB
- Stars: 157
- Watchers: 17
- Forks: 60
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-magento2 - Config ImportExport - CLI Based Config Management. (Open Source Extensions / Development Utilities)
README
# ConfigImportExport
This extension provides CLI commands for Magento 2 to import/export system configuration data.
## Why this extension?
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.
## Installation
**Add the package to your composer.json**
```bash
composer require semaio/magento2-configimportexport
```**Enable and install the module**
```bash
php bin/magento module:enable Semaio_ConfigImportExport
php bin/magento setup:upgrade
```## Facts
* Supported Magento versions are 2.3 and 2.4.
* Supported PHP versions are 7.2, 7.3, 7.4, and 8.1.## Functionality
This module is a work in progress and will be extended in the future with more functionality and support for other file formats.
### File formats
This module currently supports the following file formats:
* YAML (default)
* JSONSee [docs/file-formats.md](docs/file-formats.md) for more information and examples.
### Import config data
See [docs/config-import.md](docs/config-import.md) for more information.
### Export config data
See [docs/config-export.md](docs/config-export.md) for more information.
## Usage with Deployer
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'));
});
```## Support
If you encounter any problems or bugs, please create an issue on [GitHub](https://github.com/semaio/Magento2-ConfigImportExport/issues).
## Contribution
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](https://help.github.com/articles/using-pull-requests).
## Licence
[Open Software License (OSL 3.0)](http://opensource.org/licenses/osl-3.0.php)
## Contributors
Thanks to all [contributors](https://github.com/semaio/Magento2-ConfigImportExport/graphs/contributors) who invested their valuable time to contribute to this module. Much appreciated!
## Inspiration
This module is inspired by the awesome n98-magerun plugin "HarrisStreet ImpEx" by @SchumacherFM for Magento 1 which you can find [here](https://github.com/Zookal/HarrisStreet-ImpEx).
## Copyright
(c) 2016-2022 semaio GmbH / Rouven Alexander Rieker