Add host parameter to boxesserver

This commit is contained in:
Vyacheslav V. Anisimov 2022-05-01 02:23:52 +05:00 committed by GitHub
parent 589c3a18c4
commit c8d93bfe14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

@ -540,15 +540,20 @@ class BServer:
if __name__=="__main__": if __name__=="__main__":
host = ''
port = 8000
if len(sys.argv) > 1: if len(sys.argv) > 1:
port = int(sys.argv[1]) tmp = sys.argv[1].split(':')
else: if len(tmp) == 2:
port = 8000 host = tmp[0]
port = int(tmp[1])
else:
port = int(tmp[0])
fc = FileChecker() fc = FileChecker()
fc.start() fc.start()
boxserver = BServer() boxserver = BServer()
httpd = make_server('', port, boxserver.serve) httpd = make_server(host, port, boxserver.serve)
print("BoxesServer serving on port %s..." %port) print("BoxesServer serving on host:port %s:%s..." % (host, port) )
httpd.serve_forever() httpd.serve_forever()
else: else:
application = BServer().serve application = BServer().serve