diff --git a/hosts.json.example b/hosts.json.example index e69de29..2464575 100644 --- a/hosts.json.example +++ b/hosts.json.example @@ -0,0 +1,11 @@ +{ + "http": [ + "tanner.vc", + "forum.protospace.ca", + "protospace.ca", + "my.protospace.ca" + ], + "mqtt": [ + "webhost.protospace.ca" + ] +} diff --git a/main.py b/main.py index bc95feb..7009dd1 100644 --- a/main.py +++ b/main.py @@ -8,20 +8,16 @@ import asyncio import aiohttp import aiomqtt import ssl +import json from datetime import datetime, timedelta -HOSTS = { - 'http': [ - 'tanner.vc', - 'forum.protospace.ca', - 'protospace.ca', - 'my.protospace.ca', - ], - 'mqtt': [ - 'webhost.protospace.ca', - ], -} +try: + with open('hosts.json', 'r') as f: + HOSTS = json.load(f) +except FileNotFoundError: + logging.error("hosts.json not found. Please copy hosts.json.example to hosts.json and configure it.") + exit(1) def alert_tanner(msg):