import json
import logging
import os
+import re
import sys
import time
try:
server_address = ('', port)
httpd = server_class(server_address, handler_class)
- print('Starting alarm notifier...')
log.info("Starting alarm notifier server on port: %s", port)
httpd.serve_forever()
except Exception as exc:
if __name__ == "__main__":
- from sys import argv
-
- # Runs the webserver
- if len(argv) == 2:
- run(port=int(argv[1]))
+ cfg = Config.instance()
+ p = re.compile(':(\d+)', re.IGNORECASE)
+ m = p.search(cfg.OS_NOTIFIER_URI)
+ if m:
+ port = m.group(1)
+ run(port=int(port))
else:
run()