Skip to content

feat: use DRUPAL_PROJECTS_PATH for all commands. fixes #111 #112

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jameswilson
Copy link

@jameswilson jameswilson commented Apr 28, 2025

The Issue

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.

@weitzman
Copy link
Collaborator

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/

@weitzman weitzman added the enhancement New feature or request label May 29, 2025
- Move DRUPAL_PROJECTS_PATH to config.contrib.yaml
- Remove individual definitions from command files
- Improve documentation for theme support
@jameswilson jameswilson force-pushed the 111-env-var-project-path branch from 624584e to 19f27da Compare May 29, 2025 21:25
@jameswilson
Copy link
Author

That makes sense. Updated in 19f27da. Thanks Moshe.

Link to configuration section and note default location.
Make messaging consistent about configurable project location
throughout README and command description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants