From c0848ef9162829872fc3562d7f8cfeb1c2b23691 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Thu, 26 May 2022 10:30:33 +0200
Subject: [PATCH] Allow to disable mailhog

---
 src/Handler.php                   | 1 +
 templates/docker-compose.yml.twig | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/Handler.php b/src/Handler.php
index 9040e4d..4a67f67 100644
--- a/src/Handler.php
+++ b/src/Handler.php
@@ -101,6 +101,7 @@ class Handler extends BaseHandler {
         'overwriteconfig' => FALSE,
       ],
       'mailhog' => [
+        'enable' => 1,
         'host' => $this->env->receiveGlobal('MAILHOG_HOST', 'MailHog Host', 'smtp.freesmtpservers.com'),
         'port' => $this->env->receiveGlobal('MAILHOG_PORT', 'MailHog Port', '25'),
         'username' => $this->env->receiveGlobal('MAILHOG_USERNAME', 'MailHog Username'),
diff --git a/templates/docker-compose.yml.twig b/templates/docker-compose.yml.twig
index 9047577..a657e19 100644
--- a/templates/docker-compose.yml.twig
+++ b/templates/docker-compose.yml.twig
@@ -47,7 +47,9 @@ services:
     restart: unless-stopped
 {% endif %}
     environment:
+{% if mailhog.enable %}
       PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
+{% endif %}
       DB_HOST: mariadb
       DB_USER: drupal
       DB_PASSWORD: drupal
@@ -105,7 +107,9 @@ services:
     image: 'wodby/drupal-php:{{ php.version }}'
     restart: unless-stopped
     environment:
+{% if mailhog.enable %}
       PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
+{% endif %}
       DB_HOST: mariadb
       DB_USER: drupal
       DB_PASSWORD: drupal
@@ -260,7 +264,7 @@ services:
       traefik.http.routers.solr-{{ projectname }}.rule: Host(`solr-{{ projectdomain }}`)
 {% endif %}
 
-{% if not drupal.live|default(0) or staging %}
+{% if mailhog.enable and (not drupal.live|default(0) or staging) %}
   mailhog:
     image: 'mailhog/mailhog'
 {% if staging %}
-- 
GitLab