-
Notifications
You must be signed in to change notification settings - Fork 4.7k
wp-env: Add --config option for custom config files #75087
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
base: trunk
Are you sure you want to change the base?
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: 0 B Total Size: 3 MB ℹ️ View Unchanged
|
Add a global --config (-c) option to wp-env that allows specifying a custom configuration file path instead of using the default .wp-env.json. This enables running multiple parallel environments from the same directory. - Each config file gets isolated Docker containers via MD5-hashed work directory - Override files are derived from custom config names (e.g., staging.json → staging.override.json) - All commands (start, stop, clean, destroy, logs, run, status) support the option - Maintain full backward compatibility when flag is not provided Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The -c alias conflicts with flags commonly passed to container commands (e.g., `phpunit -c phpunit.xml.dist`). Since wp-env passes through arguments to containers, the global -c option was intercepting these flags and trying to parse them as wp-env config files. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
632fb79 to
038bcff
Compare
What?
Add a global
--configoption to wp-env that allows specifying a custom configuration file path instead of using the default.wp-env.json. This enables running multiple parallel environments from the same directory.Why?
Previously, wp-env could only use
.wp-env.jsonfrom the current directory, making it impossible to run multiple environments from the same folder. This feature enables developers to manage different environment configurations (staging, testing, etc.) with separate containers and data.How?
--configglobal CLI option via yargsstaging.json→staging.override.json)Testing Instructions
.wp-env.jsonandstaging.jsonwp-env startWP_ENV_PORT=8890 WP_ENV_TESTS_PORT=8891 wp-env start --config=staging.jsondocker psshould show separate container setswp-env statusandwp-env status --config=staging.jsonwp-env stop --config=staging.jsonwp-env status