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

Set WP_CLI_PACKAGES_DIR in config file #5645

Open
Kilbourne opened this issue May 25, 2022 · 4 comments
Open

Set WP_CLI_PACKAGES_DIR in config file #5645

Kilbourne opened this issue May 25, 2022 · 4 comments

Comments

@Kilbourne
Copy link

Hi,
I'd like to set WP_CLI_PACKAGES_DIR env var from the wp-cli config file ( ex. wp-cli.yaml).
The use case is hosting platform which don't allow to set environment variable ( or make it difficult)

@janw-me
Copy link
Member

janw-me commented May 29, 2022

Creating a wp-cli.yml config should be possible. The main place the variable is used is here.

Will also need updated documentation and tests. a possible good-first-issue ?

@schlessera
Copy link
Member

We could have an env key under the special _ key that can be used in the config file like so:

_:
    env:
        WP_CLI_PACKAGES_DIR: /home/user/.wp-cli/packages

@schlessera schlessera changed the title Set WP_CLI_PACKAGES_DIR in config file Set WP_CLI_PACKAGES_DIR in config file Jun 2, 2022
@janw-me janw-me self-assigned this Sep 14, 2022
@janw-me
Copy link
Member

janw-me commented Sep 14, 2022

So I've taken a, a look at it.
And the best way it to create a extra config-spec, specifically for the Global variables.
And while we are at it, allow all these variables (that are possible) to be overwritten in this config.
As all entries in the yml are white listed in \WP_CLI\Configurator::merge_yml()

So it's a bit more work then expected at first sight, but this is the best approach IMO.

I'd love to hear other opinions.

@danielbachhuber
Copy link
Member

Another option to consider: support for .env files. Would need some discussion around a proposed approach.

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

No branches or pull requests

4 participants