2017 © Pedro Peláez
 

library mageconfigsync

A utility to aid the storing of Magento configuration in version control.

image

punkstar/mageconfigsync

A utility to aid the storing of Magento configuration in version control.

  • Friday, January 12, 2018
  • by punkstar
  • Repository
  • 17 Watchers
  • 122 Stars
  • 3,625 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 26 Forks
  • 7 Open issues
  • 8 Versions
  • 5 % Grown

The README.md

Magento Configuration Sync

This is a tool designed to allow teams to keep Magento (1.x and 2.x supported) configuration under version control, eliminating the unknown when tracking down potentially configuration related bugs., (*1)

image, (*2)

File Syntax

The configuration values are stored in a YAML file. The format of the file is as follows:, (*3)

environment:
    scope_key:
       path: value

For example:, (*4)

production:
    default:
        dev/debug/template_hints: 0
development:
    default:
        dev/debug/template_hints: 1
    stores-1:
        currency/options/base: GBP
        dev/restrict/allow_ips: null

The above will:, (*5)

  • disable template hints on product;
  • enable template hints on the development environment;
  • set the currency to Pounds Sterling in the store scope for the store with ID #1;
  • ensure the allowed development ip's are inherited from the website for store #1.

Valid scope keys are:, (*6)

  • default
  • stores-$id
  • websites-$id

Usage

php bin/mageconfigsync --help

Most commands take an optional argument of --magento-root if not running from within a Magento directory and an optional argyment of --env used to describe the current environment of the configuration., (*7)

Dump

php bin/mageconfigsync dump --help

The dump command outputs the current contents of the configuration as YAML to stdout. Specify --env and the environment will be added as the first key, for convenience., (*8)

Load

php bin/mageconfigsync load --help

The load command synchronises the database with the contents of the file. Any changed lines will be output to stderr. The --env option will determine which section of the YAML file is loaded., (*9)

Diff

php bin/mageconfigsync diff --help configuration_file.yaml

Example Scenario

Thanks to the symfony/yaml component we can use all the tricks YAML provides us, including merge keys. Consider the following file, config.yml:, (*10)

prod:
  default: &prod_global
    currency/options/base: GBP
    dev/debug/template_hints: 0

dev:
  default:
    <<: *prod_global
    dev/debug/template_hints: 1

Our aim is to ensure that the currency is always set to GBP, regardless of the environment, but template hints should only be enabled for the local environment., (*11)

On our development machine we can pull our latest changes and run the following command to get the configuration just as we want it:, (*12)

php bin/mageconfigsync load --magento-root ~/Sites/magento --env dev config.yml

We can also use this config.yml as part of our deployment process. Consider a workflow like the following:, (*13)

// Take a backup of the configuration, incase we need to restore as part of a rollback
php bin/mageconfigsync dump --env prod > config.yml.pre-deploy

// Give us a diff for the deployment log so we can see what's about to be changed
php bin/mageconfigsync diff --file-env prod config.yml

// Sync the latest configuration changes to prod
php bin/mageconfigsync load --env prod config.yml

Congratulations, your Magento configuration is now under control, is auditable and consistent., (*14)

The Versions

12/01 2018
08/06 2017

dev-develop

dev-develop

A utility to aid the storing of Magento configuration in version control.

  Sources   Download

MIT

The Requires

 

The Development Requires

magento

15/09 2016

dev-release/0.5.0

dev-release/0.5.0

A utility to aid the storing of Magento configuration in version control.

  Sources   Download

MIT

The Requires

 

The Development Requires

magento

15/09 2016

0.5.0-beta.1

0.5.0.0-beta1

A utility to aid the storing of Magento configuration in version control.

  Sources   Download

MIT

The Requires

 

The Development Requires

magento

22/09 2015

dev-master

9999999-dev

A utility to aid the storing of Magento configuration in version control.

  Sources   Download

MIT

The Requires

 

The Development Requires

magento

22/09 2015

0.4.0

0.4.0.0

A utility to aid the storing of Magento configuration in version control.

  Sources   Download

MIT

The Requires

 

The Development Requires

magento

12/02 2015

0.3.1

0.3.1.0

A utility to aid the storing of Magento configuration in version control.

  Sources   Download

MIT

The Requires

 

The Development Requires

magento

12/09 2013

0.3.0-beta

0.3.0.0-beta

A utility to aid the storing of Magento configuration in version control.

  Sources   Download

MIT

The Requires

 

The Development Requires

magento