• This repository has been archived on 06/Jan/2022
  • Stars
    star
    131
  • Rank 275,867 (Top 6 %)
  • Language
    PHP
  • License
    MIT License
  • Created about 11 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

image

File Syntax

The configuration values are stored in a YAML file. The format of the file is as follows:

environment:
    scope_key:
       path: value

For example:

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:

  • 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:

  • 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.

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.

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.

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:

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.

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

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:

// 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.

More Repositories

1

magentotherightway.com

🌍 A (debatable) list of things I think you should be doing as a Magento Developers.
CSS
135
star
2

magefaker

🔧 Generate dummy customers for Magento
JavaScript
41
star
3

magento-delayed-events

🤔 Delayed events with Magento (Proof of concept)
PHP
23
star
4

testrig

🔧 Magento installation automation - A tool that allows for quick setup of local Magento installations, ideal for testing code across multiple versions.
PHP
19
star
5

rugby-data-api

🌍 Programmatic access to publicly available Rugby Union data
HTML
18
star
6

ssl

📚 PHP library for reading and understanding SSL certificates
PHP
16
star
7

modbuild

🔧 Build a skeleton Magento Connect extension package file from your modman contents
Ruby
16
star
8

magento_bundleddocs

Ship documentation with your Magento extension, accessible through the administration area
PHP
15
star
9

php-annotations

Simple, programmatic, access to class annotations in PHP
PHP
8
star
10

freeagent-geckoboard

Some cool FreeAgent Geckoboard Widget endpoints
PHP
6
star
11

raphael-svg-path-preview

Preview and debug your SVG paths
JavaScript
4
star
12

4sq-autocheckin

Keep forgetting to check-in to Foursquare at work? Me too.
Ruby
4
star
13

sieve

⚗️Sieve rules for sorting mail with FastMail
Python
4
star
14

instal2asp

Translate an InstAL specification into ASP for solving with an Answer Set Solver, such as Clingo.
Java
3
star
15

java-instal

Instal specification using method chaining.
Java
3
star
16

mageqa

A self-contained QA environment for Magento extensions. Perfect for CI.
3
star
17

magento-encrypted-models

Transparent Field Encryption for Magento Models. Declare a subset of your data for automatic encryption and decryption on save and load.
PHP
3
star
18

docker-o-saft

🐳 Docker container for O-Saft, the OWASP SSL advanced forensic tool
2
star
19

rsrisk

Realtime-space-risk. Boom.
JavaScript
2
star
20

realtime-battle

JavaScript
2
star
21

magedevcert

My answers to the Magento Developer's Certification study guide
PHP
2
star
22

csp-generator

🔧 A tool to suggest a Content Security Policy by simulating requests to URLs
JavaScript
2
star
23

phreeagent

A PHP library for headless access to the FreeAgent v2 API
PHP
2
star
24

arthur-robot

A super rockin' Lego NXT robot that follows walls
Java
2
star
25

codebase-notifyio

Hook up Codebase's web notifications to Notify.io
PHP
2
star
26

Random

Just a bunch of random scripts and experiments that don't deserve their own repository
1
star
27

magerun-config

1
star
28

docker-autosatis

A dockerised, self hosted, self updating satis repository.
PHP
1
star
29

gc2qif

Convert a Google Checkout CSV export to a QIF
Ruby
1
star
30

foursquare-autocheckin-client

Ruby
1
star
31

snake

Don't get too excited. A self-playing snake game with a world that can stretch across monitors on a number of computers.
PHP
1
star
32

institutions

Implementing Institutions in AgentScape. Supervised by Julian Padget.
Java
1
star
33

codebase2freeagent

Migrate codebase timeslips to freeagent tasks/timeslips
Ruby
1
star
34

cipher-tools

A set of tools I made while studying Cyptography
Ruby
1
star