Jump to Navigation

New Drupal module: Environment Indicator

Image to accompany story

The Environment Indicator adds a coloured strip to the side of the site informing you which environment you're currently in (Development, Staging, Production etc). This is incredibly useful if you have multiple environments for each of your sites, and like me, are prone to forgetting which version of the site you are currently looking at.

This module can help you avoid making configuration changes to your live server by mistake by adding a coloured strip to the side of your site, clearly marking each version of the site.

The Environment Indicator settings page allows you to modify some elements of the indicator's behaviour and appearance. Individual settings, such as the text to display and the colour can be overridden for each of your specific environments in the site's settings.php file. This allows you to customise the indicator for each of your environments without needing to make any changes in the database. This means that the Environment Indicator will always display correctly when moving your site from development to staging to production.

Settings that can be overridden in settings.php include:

environment_indicator_text
The text that will be displayed vertically down the indicator. e.g: $conf['environment_indicator_text'] = 'DEVELOPMENT SERVER';
environment_indicator_color
A valid css color. e.g: $conf['environment_indicator_color'] = 'dark-red';
environment_indicator_enabled
A boolean value indicating whether the Environment Indicator should be enabled or not. On your production environment, you should probably set this to FALSE. e.g: $conf['environment_indicator_enabled'] = FALSE;

The Environment Indicator's visibility depends upon the permissions of the viewer (access environment indicator), although it can be completely disabled by setting environment_indicator_enbled = FALSE; in settings.php.

What follows are my settings.php overrides for each of my versions of kirkdesigns.co.uk - my development server (laptop), staging server (home server) and live server (a 512 slice provided by slicehost).

Development server

On my local machine, I colour the strip blue...

$conf['environment_indicator_text'] = 'DEVELOPMENT SERVER';
$conf['environment_indicator_color'] = 'blue';

Staging server

Orange seems like an appropriate colour for a staging server...

$conf['environment_indicator_text'] = 'STAGING SERVER';
$conf['environment_indicator_color'] = 'orange';

Live server

On my live server, I don't want the indicator to show at all, so I completely disable it...

$conf['environment_indicator_enabled'] = FALSE;

Please visit the project page on drupal.org to download, test and report any problems of feature requests.

Comments

Anonymous's picture

Pretty cool. I really dig this. Thanks. Going to give it a try.Shrop

Anonymous's picture

This is indeed a very useful tool. Note that it is used n the D6 project test site: http://d6.project.drupal.org. Well done!

tom's picture

Actually, the module is not used in the d6 test site - but that is what inspired me to create it... Maybe they will use it for the d7 test site!

Anonymous's picture

This looks like a different take at what http://drupal.org/project/admin_warning tries to solve, maybe there are ways to merge development?

tom's picture

It's not really the same thing, though I can see the similarities... That module is about warning admin users that they are logged into the live site.

Environment Indicator on the other hand, displays a different colour/message depending on which environment you are in. It has nothing to do with being logged in as admin. (though you can use the permissions to configure it to show for admin users only). Infact, on all my sites I have it configured to show for anonymous users, since they are generally the ones who visit the site to approve changes, but forget which version of the site they are on.

Anonymous's picture

Nice, although sadly it seems I spend most of my time in the development stage.  This will come in handy though when I'm exporting snapshots and working side by side a live production site and making changes in a seemingly identical dev snapshot.

Anonymous's picture

I love this module.  Thanks.

Please share your thoughts, comments and suggestions...

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
If you have your own website, enter its address here and we will link to it for you. (please include http://).
eg. http://www.kirkdesigns.co.uk