configurable ports

This commit is contained in:
S. Seegel 2021-01-13 00:39:22 +01:00
parent 44b080eb5e
commit 759b31c9b9
2 changed files with 11 additions and 7 deletions

View file

@ -55,7 +55,7 @@
"idOutside": "64" "idOutside": "64"
}, },
{ {
"id": "b0", "id": "88",
"name": "Kinderzimmer", "name": "Kinderzimmer",
"tMin": 19.5, "tMin": 19.5,
"tMax": 24, "tMax": 24,
@ -64,7 +64,7 @@
"idOutside": "64" "idOutside": "64"
}, },
{ {
"id": "74", "id": "b0",
"name": "Eisfach", "name": "Eisfach",
"tMax": -18 "tMax": -18
}, },
@ -73,7 +73,7 @@
"name": "Aussen" "name": "Aussen"
}, },
{ {
"id": "9c", "id": "38",
"name": "Aussen 2" "name": "Aussen 2"
}, },
{ {
@ -88,5 +88,8 @@
"user": "admin", "user": "admin",
"pass": "admin", "pass": "admin",
"database": "sensors" "database": "sensors"
} },
"webport": 8081,
"apiport": 1900
} }

View file

@ -236,13 +236,14 @@ class Server(socketserver.ThreadingMixIn, socketserver.TCPServer):
pass pass
cache = {} cache = {}
p = config["webport"] if "webport" in config else 8080
server = Server(('0.0.0.0', 8080), MyHttpRequestHandler) server = Server(('0.0.0.0', p), MyHttpRequestHandler)
server_thread = threading.Thread(target=server.serve_forever) server_thread = threading.Thread(target=server.serve_forever)
server_thread.daemon = True server_thread.daemon = True
server_thread.start() server_thread.start()
apisrv = apiserver.ApiServer(1990) p = config["apiport"] if "apiport" in config else 1990
apisrv = apiserver.ApiServer(p)
print("Waiting for sensors...") print("Waiting for sensors...")