diff --git a/Monitor.py b/Monitor.py index dac9a76..c63a38b 100644 --- a/Monitor.py +++ b/Monitor.py @@ -6,20 +6,22 @@ import smtplib from email.mime.text import MIMEText import pandas as pd import os +from dotenv import load_dotenv + +load_dotenv() # --- Config MySQL --- config = { - "host": "54.36.188.119", - "user": "michel", - "password": "#SO2&1nf%mZ@jfh", - "database": "Sondes" + "host": os.getenv("DB_HOST"), + "user": os.getenv("DB_USER"), + "password": os.getenv("DB_PASSWORD"), + "database": os.getenv("DB_NAME") } -# --- Destinataires email --- +# --- Fonction de sélection des destinataires selon le site --- def get_destinataires(lieu): return os.getenv(f"EMAIL_{lieu.upper()}", os.getenv("EMAIL_DEFAULT")).split(",") - # --- Fonction d'envoi de mail --- def envoyer_mail(sujet, message, destinataires): msg = MIMEText(message) @@ -125,6 +127,6 @@ def surveiller(): # --- Boucle principale --- while True: - print(f"📡 Vérification à {datetime.now()}", flush=True) + print(f"🛁 Vérification à {datetime.now()}", flush=True) surveiller() time.sleep(300) # 5 minutes