mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
fix: [NotificationHelper] add config
This commit is contained in:
parent
af1ff6225e
commit
aa16c52cbf
2 changed files with 7 additions and 16 deletions
|
@ -33,22 +33,12 @@ def sendEmailNotification(recipient, alert_name, content):
|
||||||
cfg = configparser.ConfigParser()
|
cfg = configparser.ConfigParser()
|
||||||
cfg.read(configfile)
|
cfg.read(configfile)
|
||||||
|
|
||||||
sender = cfg.get("Notifications", "sender"),
|
sender = cfg.get("Notifications", "sender")
|
||||||
sender_host = cfg.get("Notifications", "sender_host"),
|
sender_host = cfg.get("Notifications", "sender_host")
|
||||||
sender_port = cfg.getint("Notifications", "sender_port"),
|
sender_port = cfg.getint("Notifications", "sender_port")
|
||||||
sender_pw = cfg.get("Notifications", "sender_pw"),
|
sender_pw = cfg.get("Notifications", "sender_pw")
|
||||||
|
if sender_pw = 'None':
|
||||||
if isinstance(sender, tuple):
|
sender_pw = None
|
||||||
sender = sender[0]
|
|
||||||
|
|
||||||
if isinstance(sender_host, tuple):
|
|
||||||
sender_host = sender_host[0]
|
|
||||||
|
|
||||||
if isinstance(sender_port, tuple):
|
|
||||||
sender_port = sender_port[0]
|
|
||||||
|
|
||||||
if isinstance(sender_pw, tuple):
|
|
||||||
sender_pw = sender_pw[0]
|
|
||||||
|
|
||||||
# raise an exception if any of these is None
|
# raise an exception if any of these is None
|
||||||
if (sender is None or
|
if (sender is None or
|
||||||
|
|
|
@ -27,6 +27,7 @@ ail_domain = http://localhost:7000
|
||||||
sender = sender@example.com
|
sender = sender@example.com
|
||||||
sender_host = smtp.example.com
|
sender_host = smtp.example.com
|
||||||
sender_port = 1337
|
sender_port = 1337
|
||||||
|
sender_pw = None
|
||||||
|
|
||||||
# optional for using with authenticated SMTP over SSL
|
# optional for using with authenticated SMTP over SSL
|
||||||
# sender_pw = securepassword
|
# sender_pw = securepassword
|
||||||
|
|
Loading…
Reference in a new issue