Set Environment
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
 Â
 Â
$ drush set-environment
Disabling 'varnish' module... [ok]
Enabling 'field_ui' module... [ok]
Enabling 'views_ui' module... [ok]
Enabling 'devel' module... [ok]
Updating domains replacing '.com' with '.local' [ok]
Environment set [ok]
drush set-environment is a simple Drush* command that helps you set up your Drupal development environment every time you deploy a Drupal database from production.
You can set custom variables on your settings file (either inside a sites/<environment> directory, in settings.local.php file or wherever)
For example:
// Enable some useful modules
$conf['set_environment_modules_enable'] = array(
'stage_file_proxy',
'devel',
'field_ui',
'views_ui',
);
// Disable Varnish module
$conf['set_environment_modules_disable'] = array('varnish');
// Replace production domain with local
$conf['set_environment_domain_search'] = 'yourdomain.com';
$conf['set_environment_domain_replace'] = 'local.yourdomain.com';
// Delete all public files before setting the environment
$conf['set_environment_delete_public_files'] = TRUE;
And then running:drush set-environment
every time you replace your development database.
It's also possible to implement hook_pre_environment() and hook_post_environment() in your own modules to run specific code before and after the environment has been set.
This is still very preliminary, feature requests are welcome. For a list of all available settings, see the source code.
This module is very similar to Environment module. The main difference is that Set Environment does not require implementing hooks, does not require having the settings in the repository (as you could put the settings file in .gitignore, for example), and does not even require drush. Also, this module is not for setting any production environment setting.
*Drush is not a requirement. The environment can also be set browsing to /set-environment path.
