Installer: infra - mail gateway
diff --git a/charts/mail-gateway/templates/maddy.yaml b/charts/mail-gateway/templates/maddy.yaml
index 16ebdfb..c80fe90 100644
--- a/charts/mail-gateway/templates/maddy.yaml
+++ b/charts/mail-gateway/templates/maddy.yaml
@@ -5,9 +5,9 @@
   namespace: {{ .Release.Namespace }}
 data:
   maddy.conf: |
-    $(hostname) = mx1.lekva.me
-    $(primary_domain) = lekva.me
-    $(local_domains) = lekva.me shve.li
+    $(hostname) = {{ .Values.mxHostname }}
+    $(primary_domain) = {{ .Values.domains.primary.name }}
+    $(local_domains) = {{ .Values.domains.primary.name }}{{ range .Values.domains.others }} {{ .name }}{{ end }}
 
     tls file /etc/maddy/certs/tls.crt /etc/maddy/certs/tls.key
 
@@ -20,21 +20,20 @@
     hostname $(hostname)
 
     msgpipeline local_routing {
-        destination lekva.me {
-            deliver_to &lekvame
+        destination {{ .Values.domains.primary.name }} {
+            deliver_to &{{ .Values.domains.primary.name }}
         }
-        destination shve.li {
-            deliver_to &shveli
+        {{ range .Values.domains.others }}
+        destination {{ .name }} {
+            deliver_to &{{ .name }}
         }
+        {{ end }}
         default_destination {
             reject 550 5.1.1 "User doesn't exist"
         }
     }
 
     smtp tcp://0.0.0.0:25 {
-        io_debug true
-        debug true
-
         insecure_auth no
 
         defer_sender_reject yes
@@ -66,9 +65,6 @@
     }
 
     submission tls://0.0.0.0:465 tcp://0.0.0.0:587 {
-        io_debug true
-        debug true
-
         auth &authsmtp
         insecure_auth yes
 
@@ -90,23 +86,23 @@
         }
     }
 
-    target.smtp lekvame {
-        debug true
-        hostname mx1.lekva.me
+    target.smtp {{ .Values.domains.primary.name }} {
+        hostname $(hostname)
         attempt_starttls false
         require_tls no
         auth off
-        targets tcp://maddy.app-maddy.svc.cluster.local:25
+        targets tcp://maddy.{{ .Values.domains.primary.namespace }}.svc.cluster.local:25
     }
 
-    target.smtp shveli {
-        debug true
-        hostname mail.shve.li
+    {{ range .Values.domains.others }}
+    target.smtp {{ .name }} {
+        hostname mail.{{ .name }}
         attempt_starttls false
         require_tls no
         auth off
-        targets tcp://maddy.shveli-app-maddy.svc.cluster.local:25
+        targets tcp://maddy.{{ .namespace }}.svc.cluster.local:25
     }
+    {{ end }}
 
     target.queue remote_queue {
         target &outbound_delivery
@@ -157,17 +153,13 @@
       labels:
         app: maddy
     spec:
-      # hostAliases:
-      # - ip: "10.43.66.220"
-      #   hostnames:
-      #   - "mx1.lekva.me"
       volumes:
       - name: config
         configMap:
           name: maddy
       - name: certs
         secret:
-          secretName: cert-mx1.lekva.me
+          secretName: cert-{{ .Values.mxHostname }}
       - name: data
         persistentVolumeClaim:
           claimName: data
@@ -240,4 +232,4 @@
     - ReadWriteOnce
   resources:
     requests:
-      storage: 100Gi
+      storage: {{ .Values.persistence.size }}
diff --git a/charts/mail-gateway/values.yaml b/charts/mail-gateway/values.yaml
index e69de29..1b066c9 100644
--- a/charts/mail-gateway/values.yaml
+++ b/charts/mail-gateway/values.yaml
@@ -0,0 +1,10 @@
+mxHostname: mx1.example.com
+domains:
+  primary:
+    name: example.com
+    namespace: example-app-maddy
+  others:
+  - name: other.com
+    namespace: other-app-maddy
+persistence:
+  size: 10Gi
diff --git a/helmfile/base/helmfile.yaml b/helmfile/base/helmfile.yaml
index f39d403..612760f 100644
--- a/helmfile/base/helmfile.yaml
+++ b/helmfile/base/helmfile.yaml
@@ -169,6 +169,20 @@
       # annotations:
       #   cert-manager.io/cluster-issuer: "selfsigned-ca"
       #   acme.cert-manager.io/http01-edit-in-place: "true"
+- name: mail-gateway
+  chart: ../../charts/mail-gateway
+  namespace: {{ .Values.name }}-mail-gateway
+  values:
+  - mxHostname: mx1.lekva.me
+  - domains:
+      primary:
+        name: lekva.me
+        namespace: app-maddy
+      others:
+      - name: shve.li
+        namespace: shveli-app-maddy
+  - persistence:
+      size: 100Gi
 
 environments:
   prod: