Skip to content

Commit

Permalink
Add proxy for Drush commands (#635)
Browse files Browse the repository at this point in the history
This will ensure that isolated sites use the correct version of php with Drush. User Login (ULI) has been improved with added uri which is known by Valet.
This requires the added command which-uri to output the domain without any protocol.
  • Loading branch information
EHLOVader authored Mar 26, 2024
1 parent c9755e7 commit c593deb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cli/valet.php
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,10 @@
$app->command('configure', function () {
DriverConfigurator::configure();
})->descriptions('Configure application with know framework settings');

$app->command('which-uri', function () {
return output( Site::domain(null));
})->descriptions('Displays the URL of the current site');
}

/**
Expand Down
14 changes: 14 additions & 0 deletions valet-plus
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,20 @@ then

exit

# Proxy Drush commands with the "php" executable on the isolated site
elif [[ "$1" = "drush" ]]
then
if [[ $2 == *"--site="* ]]; then
SITE=${2#*=}
$(php "$DIR/cli/valet.php" which-php $SITE) $(which drush) "${@:3}"
elif [[ $2 == "uli" ]]; then
$(php "$DIR/cli/valet.php" which-php) $(which drush) uli --uri=$(php "$DIR/cli/valet.php" which-uri) "${@:3}"
else
$(php "$DIR/cli/valet.php" which-php) $(which drush) "${@:2}"
fi

exit

# Finally, for every other command we will just proxy into the PHP tool
# and let it handle the request. These are commands which can be run
# without sudo and don't require taking over terminals like Ngrok.
Expand Down

0 comments on commit c593deb

Please sign in to comment.