feat: make the Drupal docroot configurable

Allow for setting a `docroot` directory for Drupal projects.

By default, I've set this to `web` as that's what the Drupal Composer
scaffold projects use, but other platforms such as Acquia Cloud hosting
use `docroot`.

This is how it can be configured in `build.yaml`:

```yaml
drupal:
  docroot: docroot
```

Fixes #2
This commit is contained in:
Oliver Davies 2023-02-19 12:56:04 +00:00
parent 8e1d0bae84
commit 1fb75c9d93
4 changed files with 12 additions and 3 deletions

View file

@ -81,6 +81,8 @@ final class BuildConfigurationCommand extends Command
'database' => new Assert\Optional(),
'drupal' => new Assert\Optional(),
'docker-compose' => new Assert\Optional(),
'dockerfile' => new Assert\Optional(),
@ -137,6 +139,13 @@ final class BuildConfigurationCommand extends Command
$this->filesToGenerate->push(['web/nginx/default.conf', 'tools/docker/images/web/root/etc/nginx/conf.d/default.conf']);
}
if ('drupal-project' === Arr::get($configurationData, 'type')) {
// Ensure a "docroot" value is set.
if (null === Arr::get($configurationData, 'drupal.docroot')) {
Arr::set($configurationData, 'drupal.docroot', 'web');
}
}
$this->generateFiles($configurationData);
return Command::SUCCESS;