Add Apache support to Drupal

This commit is contained in:
Oliver Davies 2024-04-04 19:09:53 +01:00
parent 2f6673d941
commit 3065597f64
7 changed files with 34 additions and 4 deletions

View file

@ -113,6 +113,14 @@ final class CreateListOfFilesToGenerate
path: 'tools/docker/images/php/root/usr/local/etc/php',
));
if (static::isApache(Arr::get($configurationData, 'web.type'))) {
$filesToGenerate[] = new TemplateFile(
data: 'php/drupal/apache/000-default.conf',
name: '000-default.conf',
path: 'tools/docker/images/php/root/etc/apache2/sites-available',
);
}
if (static::isCaddy(Arr::get($configurationData, 'web.type'))) {
$filesToGenerate[] = new TemplateFile(
data: 'php/drupal/caddy/Caddyfile',
@ -170,6 +178,15 @@ final class CreateListOfFilesToGenerate
return $next([$configurationData, $configDto, $filesToGenerate]);
}
private static function isApache(?string $webServer): bool
{
if (is_null($webServer)) {
return false;
}
return $webServer === WebServer::Apache->value;
}
private static function isCaddy(?string $webServer): bool
{
if (is_null($webServer)) {

View file

@ -251,7 +251,7 @@ final class ConfigDto
#[Assert\Collection([
'type' => new Assert\Required([
new Assert\Choice(choices: ['nginx', 'caddy']),
new Assert\Choice(choices: ['apache', 'caddy', 'nginx']),
]),
])]
public array $web;

View file

@ -6,6 +6,7 @@ namespace App\Enum;
enum WebServer: string
{
case Apache = 'apache';
case Caddy = 'caddy';
case Nginx = 'nginx';
}