Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate drush URI using environment variable #127

Open
paul121 opened this issue Nov 5, 2022 · 0 comments
Open

Populate drush URI using environment variable #127

paul121 opened this issue Nov 5, 2022 · 0 comments

Comments

@paul121
Copy link

paul121 commented Nov 5, 2022

What in this template can be improved or added as a feature?

The current platformsh_generate_drush_yml.php script populates the drush options.uri to the default route defined for the platformsh project. While the script is fairly simple, requiring that it be run as a deploy hook does add a certain level of complexity to the template, especially when initially trying to understand how the template works.

Thankfully drush has an easier way to set the options.uri config value - using the DRUSH_OPTIONS_URI environment variable! This can be set in the .environment file at the root of this repository. Relevant docs: https://www.drush.org/latest/using-drush-configuration/#environment-variables

An added benefit of this approach is that it becomes much easier to use this template with your own .drush/drush.yml config file. As it stands you would need to update platformsh_generate_drush_yml.php to include additional values or run a subsequent command that amends the existing .drush/drush.yml. It would be much easier if this template didn't create the .drush/drush.yml in the first place.

What exactly should be updated?

Populate DRUSH_OPTIONS_URI in .environment, something like:

# Set the default site URL for drush.
export DRUSH_OPTIONS_URI=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r 'map(select(.primary == true)) | first | .production_url')

Remove platformsh_generate_drush_yml.php

How important is this feature to you?

This does not block my work. I will likely implement this myself for reasons described above and it seemed like it may be worth contributing back to the template.

Additional context

https://www.drush.org/latest/using-drush-configuration/#drush-configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant