Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/LimeSoda/LimeSoda_EnvironmentConfiguration
Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.
https://github.com/LimeSoda/LimeSoda_EnvironmentConfiguration
Last synced: about 2 months ago
JSON representation
Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.
- Host: GitHub
- URL: https://github.com/LimeSoda/LimeSoda_EnvironmentConfiguration
- Owner: LimeSoda
- Created: 2013-12-05T12:03:09.000Z (about 11 years ago)
- Default Branch: develop
- Last Pushed: 2018-02-14T11:57:23.000Z (almost 7 years ago)
- Last Synced: 2024-08-04T01:13:53.857Z (5 months ago)
- Language: PHP
- Size: 96.7 KB
- Stars: 72
- Watchers: 24
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- mageres - LimeSoda Environment Configuration
README
LimeSoda Environment Configuration
=====================
Enables developers to modify Magento installations (configuration, data, ...) based on the given environment using
n98-magerun.Build Status
---
**Latest Release**[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/LimeSoda/LimeSoda_EnvironmentConfiguration/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/LimeSoda/LimeSoda_EnvironmentConfiguration/?branch=master)
**Development Branch**[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/LimeSoda/LimeSoda_EnvironmentConfiguration/badges/quality-score.png?b=dev)](https://scrutinizer-ci.com/g/LimeSoda/LimeSoda_EnvironmentConfiguration/?branch=develop)
Facts
-----
- version: 1.3.0 (Unreleased)
- extension key: LimeSoda_EnvironmentConfiguration
- Composer key: `limesoda/limesoda_environment-configuration`
- [extension on GitHub](https://github.com/LimeSoda/LimeSoda_EnvironmentConfiguration)Requirements
------------
- PHP >= 5.3.0
- Mage_Core
- [n98-magerun](https://github.com/netz98/n98-magerun)Compatibility
-------------
- Magento >= EE 1.13.0.2 (should also work on older and CE versions)Installation Instructions
-------------------------
1. Install the extension via [modman](https://github.com/colinmollenhour/modman) or
[Composer](https://getcomposer.org/).
2. Add names to your environments.
3. Configure environments.Usage
-----
After configuring your environments (see below) call n98-magerun like this:n98-magerun.phar ls:env:configure [environment]
### Set an environment name
Configure the environment of the environment in your XML. 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.
dev
### Adding environments
Create a new extension (or use an existing one) and add a `global > limesoda > environments` node to your `config.xml`:
Congratulations, you created your "default" environment!
Calling
n98-magerun.phar ls:env:configure default
will execute the actions you specified for this environment.
### Adding commands
Next we create a command. You create a `commands` node beneath your environment node. To add a command, you choose a
unique node name and add the n98-magerun command as the value:
config:set -- "web/unsecure/base_url" "http://www.domain.tld/"
### Using variables
You can replace hard-coded strings (e.g. URLs) with variables. Add variables for your environment as children of a
`variables` node. Then you can insert the values into commands using the notation `${variable_name}`.
config:set -- "web/unsecure/base_url" "${unsecure_base_url}"
### Add values to 'System > Configuration'
In the first two examples we set a value for `System > Configuration` using the normal `config:set` syntax. If you have
to do this for many values and different scopes this can get confusing.Alternatively you can use a special `system_config` node for setting values. It supports scopes the same way you know
it from the `default`, `websites` and `stores` nodes in `config.xml`.Use `encrypt="true"` to set an encrypted configuration value.
${unsecure_base_url}
Define values on website and store view scopes the same way. You can use the website and store code instead of the
numeric ids. If you for whatever reason prefer the ID you also can use this one instead.
${unsecure_base_url}
${unsecure_base_url}
http://seconddomain.tld/
http://thirddomain.tld/
<4>
http://fourthdomain.tld/
4>
### Overriding values for single CLI calls
Introduced in 1.3.0 you can now override one or multiple variable values when calling `ls:env:configure`:
n98-magerun.phar ls:env:configure --override='var1=val1' --override='var2=val2' mz
This command will set the value of the variable `var1` to `val1` and `var2` to `val2`, no matter what was defined in
the configuration XML.### Command stages
In the first two examples all commands were placed in the `commands` node. As we just mentioned you can use
`system_configuration` to put all system configuration settings in its own node and make big configurations clearer.
You still may have many commands left which have to be specified in `commands` and have a hard time sorting them in the
right way by being creative with the names of the XML nodes.To help a little bit with that you can use two custom stages, `pre_configure` and `post_configure`, which are executed
before and after the operations in `commands` are processed.
config:set -- "web/unsecure/base_url" "${unsecure_base_url}"
cache:disable
cache:flush
The settings from `system_configuration` are applied in the `commands` stage. This means the commands will be added in
the following order:* pre_configure
* commands
* system_configuration
* post_configure### Nesting environments
Using variables is nice but the most you will profit if you nest environments. This means you can create a base
definition for commands and variables and expand them in other environments. You do this by specifying the parent in
your environments base node: ``.A typical setup could be:
* default
* dev
* developer 1
* developer 2
* developer 3
* test
* qa
* staging
* liveIf you want to re-build this setup for the environment configuration, your XML will look like this:
If you define a command or variable in a parent environment, the child environment will inherit them.By specifying commands and variables on different levels, you can save yourself some typing and maintenance work. In the
next example we disable and flush the cache for all environments while setting a different URL for every environment.
config:set -- "web/unsecure/base_url" "${unsecure_base_url}"
cache:disable
cache:flush
### Configuration skeleton
You can use this `config.xml` skeleton as a starting point for your environment configuration.
0.0.1
Built-in commands
-----------------### ls:aoe:scheduler:job:status
Enables and disables cron jobs as used by [Aoe_Scheduler](https://github.com/AOEpeople/Aoe_Scheduler) >= 1.0.0.
ls:aoe:scheduler:job:status "[jobcode]" "[status]"
All arguments are required.
* jobcode: The Magento cron job code (e.g. `core_email_queue_send_all`)
* status: `0` for inactive, `1` for active.Example:
ls:aoe:scheduler:job:status "core_email_queue_send_all" "0"
You will get an output like `Job 'example_cron': set status to '0'.` which makes it easier to identify changes to the
crons.### ls:ess:m2epro:channel:status
Sets the channel status for Ess_M2ePro. The extension has to be installed and enabled.
ls:ess:m2epro:channel:status "[name]" "[status]"
###ls:ess:m2epro:license:key
Sets the license key for Ess_M2ePro. The extension has to be installed and enabled.
ls:ess:m2epro:license:key "[key]"
Backend Overview
----------------
Navigate to `System > Environment Configuration` to get a list of all configured environments.Click on an environment to get a list of the commands that will be executed. Variables not defined for the environment
are highlighted.Displaying the environment name in the header
---------------------------------------------### Backend
You can enable an header bar in `System > Configuration > Advanced > Admin > Environment Configuration > Display
environment name above admin header`.To make it easier for you to differentiate between environments you can configure the font and background color per
environment:
Dev Environment M.Zeis
#fff
#090
You can also display a label, see the `` node above. If no label is set, the environment name is displayed.
### Frontend
You can display the same header bar in the frontend by enabling it in `System > Configuration > Advanced > Admin >
Environment Configuration > Display environment name above frontend header`.Uninstallation
--------------
Just like any other modman or Composer installed extension. No database tables or other additional files are created.Support
-------
If you have any issues with this extension, open an issue on
[GitHub](https://github.com/LimeSoda/LimeSoda_EnvironmentConfiguration/issues).Contribution
------------
Any contribution is highly appreciated. The best way to contribute code is to open a
[pull request on GitHub](https://help.github.com/articles/using-pull-requests). Please create your pull request against
the `develop` branch.Developer
---------
Matthias Zeis
[http://www.limesoda.com](http://www.limesoda.com)
[@mzeis](https://twitter.com/mzeis)License
-------
[OSL - Open Software Licence 3.0](http://opensource.org/licenses/osl-3.0.php)Copyright
---------
(c) 2014-2015 LimeSoda Interactive Marketing GmbH