Skip to content
Snippets Groups Projects
Verified Commit c4a06e69 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Make bot optional

parent 6535d394
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,7 @@ filename = "/data/monitoring.sqlite3"
password = "swordfish"
[Alerts]
enabled = false
botname = "monitoring"
password = "supersecretpassword"
channel = "operations_fr"
......
......@@ -50,16 +50,22 @@ km3pipe.style.use('km3pipe')
URL = "https://chat.km3net.de"
CONFIG = "pipeline.toml"
rocket = None
with open(CONFIG, 'r') as fobj:
config = toml.load(fobj)
BOTNAME = config['Alerts']['botname']
PASSWORD = config['Alerts']['password']
CHANNEL = config['Alerts']['channel']
if config['Alerts']['enabled']:
rocket = RocketChat(BOTNAME, PASSWORD, server_url=URL)
log = kp.logger.get_logger(__name__)
rocket = RocketChat(BOTNAME, PASSWORD, server_url=URL)
def sendchatalert(msg):
if rocket is None:
log.warning(msg)
return
with open(CONFIG, 'r') as fobj:
shifters = toml.load(fobj)['Alerts'].get('shifters', "shifters")
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment