How can I dynamically set the site URL (in Drush9+)? In Drush 8 I had that neat little reusable line in my drushrc.php:
$options['l'] = getenv('MY_SITE_URL_VAR');

I know that I can hardcode my site URL in a drush.yml file, but that does not fit my configuration workflows, where each server knows its URL.
So how can I set the l option from an environment variable?
I don't see how you can easily reproduce that (nice) configuration setup since the yaml files are indeed static.
The only solution I see is to write a little wrapper script that always calls drush with the --uri option, like:
drush --uri $MY_SITE_URL_VAR $@

Recommended solution
A much simpler solution is to use the shell variable DRUSH_OPTIONS_URI.
export DRUSH_OPTIONS_URI=http://example.com

I wasn't able to find any documentation for this, but it seems to work.