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 len(sys.argv) > 1:
port = int(sys.argv[1])
else:
host = ''
port = 8000
if len(sys.argv) > 1:
tmp = sys.argv[1].split(':')
if len(tmp) == 2:
host = tmp[0]
port = int(tmp[1])
else:
port = int(tmp[0])
fc = FileChecker()
fc.start()
boxserver = BServer()
httpd = make_server('', port, boxserver.serve)
print("BoxesServer serving on port %s..." %port)
httpd = make_server(host, port, boxserver.serve)
print("BoxesServer serving on host:port %s:%s..." % (host, port) )
httpd.serve_forever()
else:
application = BServer().serve