HarrisStreet ImpEx for Magento

This article is part of a series covering 3rd party n98-magerun modules/extensions.

In this post we show you another great module to manage your Magento configurations. It supports importing and exporting of store config data in a hierarchical folder structure. This can be done for different environments.

The module was created by Zookal pty ltd the largest student portal in Australia.

Installation

You need to install the file directly in your Magento installation via modman.

Configuration

After the installation you should see three new commands in your command list.

  • hs:ccd:export
  • hs:ccd:import
  • hs:ccd:convert

The config data can be imported and exported in this config formats:

Now we can start with an initial export…

Export Config Data

Config data can be exported by calling the command hs:ccd:export.
The command support multiple config formats and provides this options

  • --format (-m) Format: yaml, json, csv, xml, limeSodaXml (default: “yaml”)
  • --hierarchical (-a) Create a hierarchical or a flat structure (not all export format supports that). Enable with: y (default: “n”)
  • --filename (-f) File name into which should the export be written. Defaults into var directory.
  • --include (-i) Path prefix, multiple values can be comma separated; exports only those paths
  • --exclude (-x) Path prefix, multiple values can be comma separated; exports everything except …
  • --filePerNameSpace (-s) Export each namespace into its own file. Enable with: y (default: “n”)
  • --exclude-default (-c) Excludes default values (@todo)

Let’s export the whole config data of a shop in default yaml format in seperated files and a prefix.

The command created a file containing the the config for each section of your store config. It also recognizes own sections like in my case “n98_monitoring”.

Import Config Data

Now let’s create an import environment.
We need to create a base folder which contains the structure of our organization. Each folder defines an environment.
Environments can be cascaded. The import command will process all .yaml files found in the defined folders.

In my case i created this folder structure to specify an folder for my dev environment and a staging and production area.
The base folder defines the top of your configuration cascade. It’s included evey time. The folder can be used to define default values which can be overridden in sub-folders.

The files in base folder was generated by previous export. I renamed the files and moved it to base folder.
As you can see i defined two additional files in the development area.

  • develpment/web.yaml
  • develpment/cmuench/web.yaml

If you run the import command you need to set the base folder of your configuration. In my case “configuration”.
And you need to set the relative path to your environment folder. In my case “development/cmuench”.

The development/cmuench.yaml looks like this:

This defines an special base-url for my development machine.

Let’s run the command…

The output displays all config changes:

Let’s verify the special config settings of my development machine with:

It worked! We have imported the complete config for our development machine.
Now we are able to manage the configuration of the production and staging area as well.

Conclusion

This module enables you a wide world to manage complex config environments. It’s very easy to dump the config
in a clear way.
I hope this post gives you nee ideas to use n98-magerun in your company.

It’s also possible to install the module by composer.
For more informations look at the github page of the project: https://github.com/Zookal/HarrisStreet-ImpEx

One Pingback/Trackback