Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Using Drupal's Environment Indicator to help visually manage Dev, Stage, and Production Servers

Parent Feed: 

There are days that I work on half a dozen different websites.  I'm sure some of you are in the same boat.  We make client edits and change requests with rapid efficiency.  We work locally, push to staging, test and review, then push to the live server and repeat.  I would be remiss in saying that I never made a change on the live or staging site accidentally.

The Drupal Environment Indicator module allows you to name, color, and configure a multitude of visual queues for each of your different servers, or other variables, like Git branch or path.  It is very easy to install, and can integrate with Toolbar, Admin Menu, and Mobile Friendly Navigation Toolbar for no additional screen space. 

Once installed, set the permissions of the roles you want to give permission to see the indicator.  You can adjust the general settings at /admin/config/development/environment-indicator/settings

Environment Indicator Settings

While you can create different indicators inside the admin UI, I prefer to set these in the settings.php files on the various servers so they are not overridden when we move databases back from Production back to Staging and Dev.

To do this, add the following lines into the settings.php files on each of your servers. Adjust the names and colors as you see fit:


// Local/Development Server
$conf['environment_indicator_overwrite'] = TRUE;
$conf['environment_indicator_overwritten_name'] = 'Local';
$conf['environment_indicator_overwritten_color'] = '#bb0000';

// Staging Server
$conf['environment_indicator_overwrite'] = TRUE;
$conf['environment_indicator_overwritten_name'] = 'Stage';
$conf['environment_indicator_overwritten_color'] = '#00bb00';

// Production Server
$conf['environment_indicator_overwrite'] = TRUE;
$conf['environment_indicator_overwritten_name'] = 'Production';
$conf['environment_indicator_overwritten_color'] = '#0000bb';

Environment Indicator on Admin Menu

In this day and age, we have a lot of clients that have their own staging servers to play around with layout, copy, and style.  Environment Indicator gives us, and them a sense of security that they are in the right place at the right time doing what we need to do.

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web