3

I'm using Drush 9. With the old drushrc.php I could easily include a local.drushrc.php that dynamically set the site url. How can I do it now?

This is similar to How can i set site url dynamically in Drush-9?. However I don't want to pass the url in every Drush command. I think of something like below in ../drush/drush.yml:

drush:
  paths:
    config:
      - ${env.home}/local.drush.yml

But I'd need another variable that point to the Drupal site directory (sites/default in a monosite, sites/CURRENT-SITE in a multisite). Does such a variable exist?

1

Reading https://github.com/drush-ops/drush/blob/master/examples/example.drush.yml it seems you can put a site specific drush.yml in a sites directory. It is merged with the global file(s).

PS! I haven't tested this myself.

  • 1
    Tested but it didn't work. I agree that it should have worked. – jcisio Jun 29 '18 at 6:49
  • Try checking your own example.drush.yml file in case you have an older version. The local config filename used to be different. – Andy Jun 29 '18 at 9:14
  • I'm already on Drush 9.3.0. The file sites/default/drush.yml is not automatically detected. I thought this was a problem with lightning, but I try with a standard distribution and I have the same result. – jcisio Jul 5 '18 at 13:35
  • Confirming that I'm on Drush 9.5.2 and the documentation suggests that the first place it checks is sites/default/drush.yml but this doesnt seem to be the case, because it is not picking up the default --uri option i have configured in that file options: uri: http://mysite.test when I run drush uli. Not sure what's wrong. – JamesWilson Oct 26 '18 at 16:41
  • 1
    Ok, I've figured this out: For sites/default/drush.yml to be recognized by drush you have to run drush from the drupal root folder. This used to not be a problem in drush 8 with sites/default/drushrc.php – JamesWilson Oct 26 '18 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.