Hi all,

I just wondered if I can use Drush to set the environment variables (text, color, on/off) once I clone or move a site? Thanks for anyone who has a suggestion.

Comments

rajmataj’s picture

I think you're better off setting these in your settings.php file, since that's what will be unique on each server (dev, staging, live). Below are samples for each one that I use. Remove the comments for the particular location you have your site on. If you know how to use nano or vi, you could also do this via the command line.

/**
 * Environment indicator:
 */
$conf['environment_indicator_text'] = 'DEV';
$conf['environment_indicator_color'] = 'rgba(51,153,51,0.8)'; /* green */
$conf['environment_indicator_enabled'] = TRUE;

# $conf['environment_indicator_text'] = 'STAGE';
# $conf['environment_indicator_color'] = 'rgba(255,255,102,0.8)'; /* yellow */
# $conf['environment_indicator_enabled'] = TRUE;

# $conf['environment_indicator_text'] = 'LIVE';
# $conf['environment_indicator_color'] = 'rgba(255,51,51,0.8)'; /* red */
# $conf['environment_indicator_enabled'] = TRUE;
damienmckenna’s picture

Issue summary: View changes
Status: Active » Fixed

This module's settings are controlled with variables, and Drush already supports handling variables. After saving the settings page, you can find out what variables are available by running the following:

drush vget environment_indicator

That'll display something like the following:

environment_indicator_color: '#140cd0'
environment_indicator_enabled: '1'
environment_indicator_margin: 1
environment_indicator_position: 'left'
environment_indicator_suppress_pages: 'imagecrop/*
'
environment_indicator_text: 'TEST'

Any of these can then be updated, like this:

drush vget environment_indicator_text 'hey ho'

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

el_reverend’s picture

The proper method for setting the environment indicator is:

drush vset environment_indicator_text 'QA Site'