Skip to content

Populate drush URI using environment variable #127

@paul121

Description

@paul121

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions