diff --git a/packages/grid/helm/syft/templates/backend/backend-statefulset.yaml b/packages/grid/helm/syft/templates/backend/backend-statefulset.yaml index 2d1a6880c33..bb126d3dcd3 100644 --- a/packages/grid/helm/syft/templates/backend/backend-statefulset.yaml +++ b/packages/grid/helm/syft/templates/backend/backend-statefulset.yaml @@ -113,13 +113,14 @@ spec: key: rootPassword - name: POSTGRESQL_DBNAME value: {{ .Values.postgres.dbname | quote }} + {{- if .Values.server.smtp.enabled }} # SMTP - name: SMTP_HOST - value: {{ .Values.server.smtp.host | quote }} + value: {{ .Values.server.smtp.host | required "server.smtp.host is required" | quote }} - name: SMTP_PORT - value: {{ .Values.server.smtp.port | quote }} + value: {{ .Values.server.smtp.port | required "server.smtp.port is required" | quote }} - name: SMTP_USERNAME - value: {{ .Values.server.smtp.username | quote }} + value: {{ .Values.server.smtp.username | required "server.smtp.username is required" | quote }} - name: SMTP_PASSWORD {{- if .Values.server.smtp.existingSecret }} valueFrom: @@ -127,10 +128,11 @@ spec: name: {{ .Values.server.smtp.existingSecret }} key: smtpPassword {{ else }} - value: {{ .Values.server.smtp.password | quote }} + value: {{ .Values.server.smtp.password | required "server.smtp.password is required" | quote }} {{ end }} - name: EMAIL_SENDER - value: {{ .Values.server.smtp.from | quote}} + value: {{ .Values.server.smtp.from | required "server.smtp.from is required" | quote}} + {{- end }} # SeaweedFS {{- if ne .Values.server.type "gateway"}} - name: S3_ROOT_USER diff --git a/packages/grid/helm/syft/values.yaml b/packages/grid/helm/syft/values.yaml index ba3eebffde8..e78910db98b 100644 --- a/packages/grid/helm/syft/values.yaml +++ b/packages/grid/helm/syft/values.yaml @@ -188,13 +188,16 @@ server: # SMTP Settings smtp: + enabled: false + + host: null + port: null + from: null + username: null + password: null + # Existing secret for SMTP with key 'smtpPassword' existingSecret: null - host: hostname - port: 587 - from: noreply@openmined.org - username: apikey - password: password # Extra environment vars env: null diff --git a/packages/syft/src/syft/service/notifier/notifier_service.py b/packages/syft/src/syft/service/notifier/notifier_service.py index 8f788d09431..37ca2979cdf 100644 --- a/packages/syft/src/syft/service/notifier/notifier_service.py +++ b/packages/syft/src/syft/service/notifier/notifier_service.py @@ -129,14 +129,14 @@ def turn_on( public_message="You must provide both server and port to enable notifications." ) - logging.debug("Got notifier from db") + logger.debug("Got notifier from db") skip_auth: bool = False # If no new credentials provided, check for existing ones if not (email_username and email_password): if not (notifier.email_username and notifier.email_password): skip_auth = True else: - logging.debug("No new credentials provided. Using existing ones.") + logger.debug("No new credentials provided. Using existing ones.") email_password = notifier.email_password email_username = notifier.email_username @@ -150,7 +150,7 @@ def turn_on( ) if not valid_credentials: - logging.error("Invalid SMTP credentials.") + logger.error("Invalid SMTP credentials.") raise SyftException(public_message=("Invalid SMTP credentials.")) notifier.email_password = email_password @@ -181,7 +181,7 @@ def turn_on( notifier.email_sender = email_sender notifier.active = True - logging.debug( + logger.debug( "Email credentials are valid. Updating the notifier settings in the db." ) @@ -238,7 +238,7 @@ def init_notifier( email_sender: str | None = None, smtp_port: int | None = None, smtp_host: str | None = None, - ) -> SyftSuccess: + ) -> SyftSuccess | None: """Initialize Notifier settings for a Server. If settings already exist, it will use the existing one. If not, it will create a new one. @@ -343,7 +343,7 @@ def dispatch_notification( # If notifier is active if notifier.active and notification.email_template is not None: - logging.debug("Checking user email activity") + logger.debug("Checking user email activity") if notifier.email_activity.get(notification.email_template.__name__, None): user_activity = notifier.email_activity[