From 7affdb0ca09d08bcb7d699dd9b4916bdbd68434f Mon Sep 17 00:00:00 2001 From: DenitsaTH Date: Thu, 6 Jun 2024 21:45:36 +0300 Subject: [PATCH] email notification: remove env vars from global scope --- src/app/email_notification.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/email_notification.py b/src/app/email_notification.py index 34129e7..430efb9 100644 --- a/src/app/email_notification.py +++ b/src/app/email_notification.py @@ -1,13 +1,16 @@ from mailjet_rest import Client import os -from dotenv import load_dotenv -load_dotenv() -api_key = os.environ['MAIL_API_KEY'] -api_secret = os.environ['MAIL_API_SECRET_KEY'] -sender_mail = os.environ['SENDER_EMAIL'] +def email_vars_setup(): + api_key = os.getenv('MAIL_API_KEY') + api_secret = os.getenv('MAIL_API_SECRET_KEY') + sender_mail = os.getenv('SENDER_EMAIL') + return api_key, api_secret, sender_mail + + +api_key, api_secret, send_email = email_vars_setup() mailjet = Client(auth=(api_key, api_secret), version='v3.1')