Skip to content

Ability to set environment variables in wp-cli.yml #5566

Closed

Description

@tomsommer

Sometimes environment variables (https://make.wordpress.org/cli/handbook/references/config/#environment-variables) are not available in the shell for wp-cli, and thus it would be nice to be able to set these in wp-cli.yml

Example would be to configure WP_CLI_CACHE_DIR etc. using the wp-cli.yml file.

Activity

  1. danielbachhuber commented on Jan 19, 2023

    @danielbachhuber
    Member

    Thanks for the suggestion, @tomsommer

    I'd be open to this if someone wants to submit a pull request!

    To clarify the implementation: we wouldn't want to have wp-cli.yml set environment variables. Rather, we'd want to update WP-CLI to check wp-cli.yml for a value if the corresponding environment variable wasn't set.

    Sometimes environment variables are not available in the shell for wp-cli

    For posterity, could you provide a bit more detail as to when this isn't the case?

  2. danielbachhuber commented on Jan 19, 2023

    @danielbachhuber
    Member

    Related #6130

  3. swissspidy commented on Nov 15, 2025

    @swissspidy
    Member

    Related: #5645

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions