Default drush alias in aliases.drushrc.php?

I have drush working on multiple sites with this in aliases.drushrc.php

<?php $aliases = array( 'site1' => array( 'uri' => 'site1.com', 'root' => '/Applications/MAMP/htdocs/site1/docroot', ), 'site2' => array( 'uri' => 'site2.com', 'root' => '/Applications/MAMP/htdocs/site2/public', ), ); 

This works fine, but I am not only working on a single site, so I would like to leave the site name when executing drush commands. So instead of drush @site1 cc I could just do drush cc all . Can I do this in this file?

+5
source share
2 answers

Try it,

 $aliases['dev'] = array( 'root' => '/path/to/drupal', 'uri' => 'dev.mydrupalsite.com', ); $aliases['prado'] = array( 'root' => '/path/to/drupal', 'uri' => 'dev.mydrupalsite.com', ); 

then run the following command,

 drush @dev status drush @prado status 

Tag Demo Video

+3
source

The key is the "use drush" command.

So, if you set the alias to ~ / .drush / aliases.drushrc.php, for example

  <?php /** * @file * Site alias */ $aliases['local'] = array( 'root' => '/var/www/drupal/web', 'uri' => '0.0.0.0', ); 

In your terminal type drush use @local , in order to be able to run drush commands for your site outside the project root, without having to specify @ which site each time, for example. just using drush cr

0
source

All Articles