SIENTIAPDE-1172
feat: integrate email configuration and enhance orchestrator activities - Added email configuration parameters to values.yaml for sender details and SMTP settings. - Refactored Email class to correct parameter names and improve logging during initialization. - Introduced build_email_config function to streamline email configuration retrieval. - Updated worker.py to include email and Postgres configurations in the main orchestration process.
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
from temporalio import activity, workflow
|
||||
from temporalio.client import Client
|
||||
from temporalio import workflow
|
||||
|
||||
from orchestrator.activities.email import Email
|
||||
from orchestrator.activities.mongo_db import MongoDB
|
||||
|
||||
with workflow.unsafe.imports_passed_through():
|
||||
from orchestrator.activities.couchbase import Couchbase
|
||||
from orchestrator.activities.temporal_manager import TemporalManager
|
||||
from orchestrator.activities.slot_manager import SlotManager
|
||||
from orchestrator.activities.formatters import Formatters
|
||||
from orchestrator.activities.email import Email
|
||||
from orchestrator.activities.mongo_db import MongoDB
|
||||
from typing import Any
|
||||
from logging import Logger
|
||||
from sientia_do.temporal.activities.postgres import Postgres
|
||||
@@ -67,8 +65,8 @@ class Activities( # Couchbase,
|
||||
Email.__init__(self,
|
||||
sender_email=email_config['sender_email'],
|
||||
sender_password=email_config['sender_password'],
|
||||
smpt_server=email_config['smpt_server'],
|
||||
port=email_config['port'],
|
||||
smtp_server=email_config['smtp_server'],
|
||||
smtp_port=email_config['smtp_port'],
|
||||
logger=logger,
|
||||
notification_handler=notification_handler)
|
||||
|
||||
|
||||
@@ -17,20 +17,22 @@ with workflow.unsafe.imports_passed_through():
|
||||
|
||||
class Email(BaseActivity):
|
||||
def __init__(self, sender_email: str, sender_password: str,
|
||||
smpt_server: str, port: int,
|
||||
smtp_server: str, smtp_port: int,
|
||||
logger: Logger, notification_handler: NotificationHandler):
|
||||
|
||||
self.email_builder = EmailBuilder(logger=logger)
|
||||
|
||||
self.sender_email = sender_email
|
||||
self.sender_password = sender_password
|
||||
self.port = port
|
||||
self.smtp_port = smtp_port
|
||||
|
||||
logger.info(f"Initializing Email with {smtp_server}:{smtp_port}")
|
||||
|
||||
self.server = smtplib.SMTP(smtp_server, smtp_port)
|
||||
|
||||
if self.sender_password:
|
||||
self.server = smtplib.SMTP_SSL(smpt_server, port)
|
||||
self.server.starttls()
|
||||
self.server.login(self.sender_email, self.sender_password)
|
||||
else:
|
||||
self.server = smtplib.SMTP(smpt_server, port)
|
||||
|
||||
BaseActivity.__init__(self,
|
||||
logger=logger,
|
||||
|
||||
Reference in New Issue
Block a user