Table of Content #


Introduction #

If not already done, you might be interested in this introduction page about Environment Indicator module

This documentation is for Environment Indicator module version 7.x-2.x. For version 7.x-1.x, find this other documentation page.


Difference #

Note that the Environment Indicator (envindicator) project was a complete rewrite of Environmental Indicator. This project has been incorporated back into Environment Indicator (environment_indicator) as part of the 7.x-2.x branch. Key differences with the 7.x-1.x release:

  • You can configure all your indicators from one place
  • You can position your indicator to not to interfere with your design
  • You can control permissions per environment. This way you can show the indicator for anonymous users in all the environments except for production.
  • You can export your configurations to code and include them in GIT
  • It can be used on dynamically generated environments
  • Your site builders won't need to access your settings.php
  • It's integrated with the Features module
  • It's integrated with the Toolbar module
  • Integration with Admin menu module
  • You have an environment switcher to open the current page in a different environment.
  • You have a favicon indicator that will help you notice which tab is the production environment without ever opening the tab.
  • There is also a super cool thing called Environment Indicator Variables, which will allow you to override the values of variables per environment. Read more below.

Environment Indicator Variables #

Environment Indicator Variables allow you to override the values of variables per environment. To configure this, find the steps below.

Watch the video in:

Video

  1. Install your module as usual.
  2. Go to: admin/config/development/environment-indicator. Click on "Add" button to add an environment. Configure appropriately:
    1. Giving it a name
    2. Setting a regular expression that will match the hostname: you can just paste in your hostname. Hostname format is: yourdomainname.extension
    3. Select a color
    4. Select the position

OR The settings for the Environment Indicator, such as the text to display and the color can be overridden for each of your specific environments using the configuration UI or in the site's settings.php file. You can also export this configuration to code, this allows you to customize the indicator for each environment 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. If you choose to detect your environment using settings.php, then all configuration variables can be overridden in settings.php, but the most common three are:

VERSION 2.x

// Whether the Environment Indicator should use the settings.php variables for the indicator. On your production environment, you should probably set this to FALSE.
$conf['environment_indicator_overwrite'] = TRUE;

// The text that will be displayed on the indicator. 
$conf['environment_indicator_overwritten_name'] = 'Staging';

// Valid css colors for the text and background of the admin toolbar and environment indicator.
$conf['environment_indicator_overwritten_color'] = '#ff5555';
$conf['environment_indicator_overwritten_text_color'] = '#ffffff';

// Where your indicator may appear. Allowed values are "top" and "bottom".
$conf['environment_indicator_overwritten_position'] = 'top';

// A boolean value indicating whether the Environment Indicator should be visible at all times, fixed at the top/bottom of the screen.
$conf['environment_indicator_overwritten_fixed'] = FALSE;

VERSION 1.x


$conf['environment_indicator_enabled'] = FALSE;
$conf['environment_indicator_text'] = 'Staging';
$conf['environment_indicator_color'] = '#ff5555';

Usage Usage


Permission #

  1. Go to admin/people/permissions
  2. Under environment indicator section, set appropriate permission(s) per role(s)
  3. Click on Save button
  4. In the future, for each new Environment Indicator Variables you create, you need to repeat the last three steps above.
  5. Done. You have successfully configure Environment indicator.

Comments

zoheir.nabavi’s picture

On your production environment, you should probably set this to FALSE.

Why is that?

bret.miller’s picture

I suspect that most organizations wouldn't want "Production Environment" or "Live Site" displayed publicly. I plan to leave it enabled and define my "default_environment" as the production site so public won't see the indicator, but anyone who logs in (just admins and contributors here) will see it. I think that's a better way than disabling it altogether. Of course the option to do that is only available in the 2.x versions so it wouldn't be available on Drupal 6.

zoheir.nabavi’s picture

I kind of do understand your point. But if you are overriding these in 'settings.php' file (assuming different colors for each environment) you can simply keep them on your production and make sure only certain roles see the indicator. I am just not sure if I understand the purpose of turning the override off on prod