Skip to content

Commit

Permalink
Merge branch 'main' into 18-implement-template-for-sf-emails
Browse files Browse the repository at this point in the history
  • Loading branch information
jcadam14 committed Feb 27, 2024
2 parents 6934efc + bb610d6 commit 62ff457
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 5 deletions.
7 changes: 7 additions & 0 deletions mailpit_chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: mailpit
description: A simple Helm Chart for mailpit

type: application

version: 0.1.0
54 changes: 54 additions & 0 deletions mailpit_chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mailpit
namespace: regtech
labels:
mailing.app: mailpit
spec:
replicas: 1
selector:
matchLabels:
mailing.app: mailpit
template:
metadata:
labels:
mailing.app: mailpit
spec:
serviceAccountName: secrets-csi-sa
volumes:
- name: mailing-api-secrets
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: regtech-provider
containers:
- name: mailpit
image: "axllent/mailpit"
imagePullPolicy: Always
volumeMounts:
- name: mailing-api-secrets
mountPath: "/mnt/secrets-store"
readOnly: true
env:
- name: MP_SMTP_AUTH_ACCEPT_ANY
value: "0"
- name: MP_SMTP_AUTH_ALLOW_INSECURE
value: "1"
- name: SMTP_USERNAME
valueFrom:
secretKeyRef:
name: mailing-api-secrets
key: SMTP_USERNAME
- name: SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: mailing-api-secrets
key: SMTP_PASSWORD
- name: MP_SMTP_AUTH
value: "$(SMTP_USERNAME):$(SMTP_PASSWORD)"
ports:
- containerPort: 8025
- containerPort: 1025
resources: {}
13 changes: 13 additions & 0 deletions mailpit_chart/templates/mapping.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.mapping.enabled }}
apiVersion: getambassador.io/v2
kind: Mapping
metadata:
name: mailpit
namespace: regtech
spec:
ambassador_id:
--apiVersion-v3alpha1-only--default
host: {{ .Values.mapping.host }}
prefix: {{ .Values.mapping.prefix }}
service: mailpit
{{- end }}
20 changes: 20 additions & 0 deletions mailpit_chart/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
name: mailpit
namespace: regtech
labels:
mailing.app: mailpit
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8025
protocol: TCP
name: http
- port: 1025
targetPort: 1025
protocol: TCP
name: smpt-port
selector:
mailing.app: mailpit
13 changes: 8 additions & 5 deletions regtech_mail_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
allow_origins=[
"*"
], # thinking this should be derived from an env var from docker-compose or helm values
allow_methods=["*"],
allow_headers=["authorization"],
allow_methods=["GET", "POST"],
allow_headers=["*"],
)


Expand All @@ -43,8 +43,8 @@
mailer = SmtpMailer(
settings.smtp_host, # type: ignore
settings.smtp_port,
settings.smtp_username.get_secret_value(), # type: ignore
settings.smtp_password.get_secret_value(), # type: ignore
settings.smtp_username.get_secret_value() if settings.smtp_username else None, # type: ignore
settings.smtp_password.get_secret_value() if settings.smtp_password else None, # type: ignore
settings.smtp_use_tls,
)
case EmailMailerType.MOCK:
Expand All @@ -64,7 +64,10 @@ def read_root(request: Request):
async def send_email(request: Request):
sender_addr = request.user.email
sender_name = request.user.name
subject = f"SBL Portal User Request for {sender_name if sender_name else request.user.username}"
type = request.headers["case-type"]
subject = f"[DEV BETA] SBL Portal User Request for {type}" + (
f" by {sender_name}" if sender_name else ""
)

sender = f"{sender_name} <{sender_addr}>" if sender_name else sender_addr

Expand Down

0 comments on commit 62ff457

Please sign in to comment.