From 54fddbe074327a26c3e320cc93abb71579a815c4 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 11 Apr 2017 10:09:58 -0500 Subject: [PATCH] Fixes #1355: Make Drush alias for 'local' work in VM guest or host by default. (#1356) * Fixes #1355: Make Drush alias for 'local' work in VM guest or host by default. * Issue #1355: Clean up comments in Drupal VM aliases file. --- .../drupal-vm/drupal-vm.aliases.drushrc.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/drupal-vm/drupal-vm.aliases.drushrc.php b/scripts/drupal-vm/drupal-vm.aliases.drushrc.php index dd807f1b9..81fe787ec 100644 --- a/scripts/drupal-vm/drupal-vm.aliases.drushrc.php +++ b/scripts/drupal-vm/drupal-vm.aliases.drushrc.php @@ -1,11 +1,13 @@ -// [vagrant_machine_name].local +// Local environment. $aliases['${project.machine_name}.local'] = array( - // /var/www/[vagrant_machine_name]/docroot 'root' => '/var/www/${project.machine_name}/docroot', - // vagrant_hostname 'uri' => '${project.local.uri}', - // vagrant_hostname - 'remote-host' => '${project.local.hostname}', - 'remote-user' => 'vagrant', - 'ssh-options' => '-o PasswordAuthentication=no -i ' . drush_server_home() . '/.vagrant.d/insecure_private_key' -); + ); +// Add remote connection options when alias is used outside VM. +if ('vagrant' != $_SERVER['USER']) { + $aliases['${project.machine_name}.local'] += array( + 'remote-host' => '${project.local.hostname}', + 'remote-user' => 'vagrant', + 'ssh-options' => '-o PasswordAuthentication=no -i ' . drush_server_home() . '/.vagrant.d/insecure_private_key' + ); +}