allow a parameter to change the port of the server

This commit is contained in:
Georges Khaznadar 2019-10-31 16:43:17 +01:00 committed by Florian Festi
parent b9d229a7c3
commit 00f25e43c7
1 changed files with 6 additions and 2 deletions

View File

@ -517,11 +517,15 @@ class BServer:
return (l.encode("utf-8") for l in result) return (l.encode("utf-8") for l in result)
if __name__=="__main__": if __name__=="__main__":
if len(sys.argv) > 1:
port = int(sys.argv[1])
else:
port = 8000
fc = FileChecker() fc = FileChecker()
fc.start() fc.start()
boxserver = BServer() boxserver = BServer()
httpd = make_server('', 8000, boxserver.serve) httpd = make_server('', port, boxserver.serve)
print("Serving on port 8000...") print("BoxesServer serving on port %s..." %port)
httpd.serve_forever() httpd.serve_forever()
else: else:
application = BServer().serve application = BServer().serve