Skip to content
Snippets Groups Projects
Commit a1871e89 authored by jurgenhaas's avatar jurgenhaas
Browse files

Implement support to overwrite apache configuration

parent f43b122b
No related branches found
Tags v3.7.55
No related merge requests found
......@@ -79,7 +79,10 @@ class Handler extends BaseHandler {
$twig = new \Twig_Environment($twig_loader);
$options['webRoot'] = $webRoot . '/';
$orig_ignored = FALSE;
foreach ($this->getFiles($projectRoot, $webRoot, $settingsPath) as $template => $def) {
foreach ($this->getFiles($projectRoot, $webRoot, $settingsPath, $options) as $template => $def) {
if (isset($def['condition']) && !$def['condition']) {
continue;
}
if (!$fs->exists($def['dest'])) {
$fs->mkdir($def['dest']);
}
......@@ -161,11 +164,13 @@ class Handler extends BaseHandler {
* Name of the web's root directory.
* @param string $settingsPath
* Name of the settings directory.
* @param array $options
* Keyed array with all current options.
*
* @return array
* List of files.
*/
protected function getFiles($projectRoot, $webRoot, $settingsPath): array {
protected function getFiles($projectRoot, $webRoot, $settingsPath, $options): array {
return [
'settings.docker.php' => [
'dest' => $projectRoot . '/' . $settingsPath,
......@@ -194,7 +199,11 @@ class Handler extends BaseHandler {
'dest' => $projectRoot . '/tests/backstop',
'add2yaml' => TRUE,
'add2git' => TRUE,
]
],
'vhost.conf' => [
'dest' => $projectRoot . '/apache',
'condition' => $options['webserver']['overwriteconfig'],
],
];
}
......@@ -256,6 +265,7 @@ class Handler extends BaseHandler {
],
'webserver' => [
'type' => 'apache',
'overwriteconfig' => (bool) $env->receiveGlobal('WEBSERVER_CONFIG_OVERWRITE', 'Overwrite webserver config (0 or 1)', '0'),
],
'varnish' => [
'enable' => 0,
......
......@@ -71,6 +71,9 @@ services:
{% elseif webserver.type == 'apache' %}
APACHE_VHOST_PRESET: php
APACHE_LOG_LEVEL: debug
{% if webserver.overwriteconfig %}
APACHE_INCLUDE_CONF: /var/www/html/apache/vhost.conf
{% endif %}
{% endif %}
{{ webserver.type|upper }}_BACKEND_HOST: php
{{ webserver.type|upper }}_SERVER_ROOT: /var/www/html/{{ webRoot }}
......
<VirtualHost *:80>
DocumentRoot "/var/www/html/{{ webRoot }}/"
ServerName default
Include conf/preset.conf
<Location />
Require all granted
</Location>
SetEnv HTTPS on
SetEnvIf X-Forwarded-Proto https HTTPS=on
SetEnvIf Request_URI "^/\.healthz$" dontlog
RedirectMatch 204 .healthz
<IfModule mod_proxy_http.c>
SSLProxyEngine on
</IfModule>
</VirtualHost>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment