Helps you to protect your live environment (and others) by checking that all settings are what they should be.
- version: 1.0.1
- extension key: LimeSoda_LiveGuard
- GitHub URL: https://github.com/LimeSoda/LimeSoda_LiveGuard
You can use LimeSoda_LiveGuard to define "guards" that check if settings are what you expect them to be in the given environment.
A typical use case is to make sure that no production settings are used in non-production environments.
- PHP >= 5.2.0
Tested with these Magento versions:
- Magento CE 188.8.131.52 - 184.108.40.206
- Magento EE 220.127.116.11 - 18.104.22.168
Other versions may work too.
- Set an environment in your configuration XML (e.g. local.xml). See "Usage" for more information.
- Install the extension via modman.
Set an environment name
Very important: set a name for your environment before you install the extension!
Your shop won't run if this extension is installed and you didn't define an environment.
This happens to make sure that everything is configured properly and no guard is missed because of a misconfiguration.
Configure the environment in your XML. Normally you already should have defined the environment when you installed
Most of the time you will want to put this in local.xml as this file doesn't get shared between copies of the shop in most setups.
<config> <global> <limesoda> <environment> <name>dev</name> </environment> </limesoda> </global> </config>
Add guards by creating a new extension (or using an existing one) and adding new guards under the
global > limesoda_liveguard > guards node in
As with the environment setting this extension follows a defensive approach for the guards configuration. This means that you have to set
false explicitly and add an
environments_to_omit if the guard should not be running in the specified environment.
<config> <global> <limesoda> <guards> <m2epro_guard> <active>true</active> <environments_to_omit>live</environments_to_omit> <class>yourextension/yourclass</class> </m2epro_guard> </guards> </limesoda> </global> </config>
What you define:
active: If the value is any other value than
falsethe guard will be active.
environments_to_omit: The environments in which the guard should not be active. You can separate several environments with a comma.
class: A string identifying the guard class. You define this like you would define any other class (e.g. when defining an observer). This class has to implement the
Implementing a guard
A guard can be any class implementing the
The class only has to implement the method
Check what ever you want to check in this method and throw an Exception if the check fails (that is: a production environment is in danger).
- Remove the extension like any modman extension.
If you have any issues with this extension, open an issue on GitHub.
Any contribution is highly appreciated. The best way to contribute code is to open a pull request on GitHub.
(c) 2013-2015 LimeSoda Interactive Marketing GmbH