ddev-drupal-contrib
ddev-drupal-contrib copied to clipboard
feat: use DRUPAL_PROJECTS_PATH for all commands. fixes #111
The Issue
- #111
Leverage environment variable DRUPAL_PROJECTS_PATH in all custom ddev commands shipped with ddev-drupal-contrib.
How This PR Solves The Issue
Adds the following line to all commands:
DRUPAL_PROJECTS_PATH=${DRUPAL_PROJECTS_PATH:-modules/custom}
so that the $DRUPAL_PROJECTS_PATH environment variable can be used, if defined in .ddev/config.local.yaml, instead of the hardcoded fallback value modules/custom.
Manual Testing Instructions
ddev add-on get https://github.com/jameswilson/ddev-drupal-contrib/tarball/111-env-var-project-path
Set a custom symlink location in .ddev/config.local.yaml
web_environment:
- ...
- DRUPAL_PROJECTS_PATH=modules
Restart, re-symlink, then run one of the additional commands, eg eslint (if your module has custom js).
ddev restart
ddev symlink-project
ddev eslint
Automated Testing Overview
The existing integration from #101 does not have any test coverage for DRUPAL_PROJECTS_PATH. And existing tests still hardcode the modules/custom folder. Happy to add a test if required, but since this is an environment variable, it's unclear how we would actually test this. Can environment variables be passed into ddev commands that run inside the web container on the fly?
Release/Deployment Notes
No known impacts on other code or existing projects leveraging the ddev-drupal-contrib addon. Existing projects that already leverage DRUPAL_PROJECTS_PATH should find that all of the bundled ddev command now work properly.
Lets define DRUPAL_PROJECT_PATH once in https://github.com/ddev/ddev-drupal-contrib/blob/main/config.contrib.yaml and then its available anywhere. To override it, a user can set in .env or in a config.personal.yaml. Docs should link to https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/
That makes sense. Updated in 19f27da. Thanks Moshe.
Thanks for the merge @weitzman !!