Environment

Developer

Trevor Davis

3rd Party (Free)

46 downloads (last 90 days)

GNU General Public License v3 Download v1.2

EE Version Support

  • ExpressionEngine 2

Compatibility

If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.

  • Updater
  • Multi Site Manager
  • Stand Alone Entry Form
  • Low Variables
  • Content Elements
  • Better Workflow
  • Matrix
  • Grid
  • Webservice
  • Publisher

Requirements

Add-On Type(s)

Accessory

Tags

Display which environment you are on at all times in the CP so you don't accidentally do something bad on the production environment.

In your config.php, set an ENV variable like so:

if(!defined('ENV')) {
	switch ($_SERVER['SERVER_NAME']) {
		case 'site.com':
			define('ENV', 'prod');
		break;
		
		case 'stage.site.com':
			define('ENV', 'staging');
		break;
	
		default:
			define('ENV', 'local');
		break;
	}
}

The value of ENV will be injected into the header of the CP and fixed to the screen as you scroll.

You can also change the color of the environment label using a config variable named environment_color, just pass in a valid CSS color.

if(!defined('ENV')) {
	switch ($_SERVER['SERVER_NAME']) {
		case 'site.com':
			define('ENV', 'prod');
			$config['environment_color'] = 'green';
		break;
	
		default:
			define('ENV', 'local');
			$config['environment_color'] = '#f00';
		break;
	}
}

You can customize which member groups see the label by using a config variable named environment_member_groups and assigning it to an array of member group IDs.

$config['environment_member_groups'] = array(1, 6);

By default, it is visible to the Super Admin member group.

Download Environment

EE Support Downloads Add-On Version Release Date
Not Specified Download 1.2 Apr 17, 2013

Environment Links

This entry was created October 18, 2012, 11:38 am.
This entry was last updated February 25, 2014, 8:38 pm.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.

1 Review:

MoreSoda 10.22.12

Rating - {addon_rating_average}

A couple of weeks ago in the office we were discussing creating an add on which does exactly what this does, so thank you very much! Will be getting installed by default on all our sites.