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

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

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';

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.