add new host options for server and urwid client
parent
7346a9410f
commit
7267a700f8
|
@ -34,6 +34,7 @@ import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
# XxX_N0_4rgP4rs3_XxX ###yoloswag
|
||||||
try:
|
try:
|
||||||
port_spec = argv.index("--port")
|
port_spec = argv.index("--port")
|
||||||
port = argv[port_spec+1]
|
port = argv[port_spec+1]
|
||||||
|
@ -43,7 +44,15 @@ except IndexError: # flag given but no value
|
||||||
exit("thats not how this works, silly! --port 7099")
|
exit("thats not how this works, silly! --port 7099")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
network = BBJ(host="127.0.0.1", port=port)
|
host_spec = argv.index("--host")
|
||||||
|
host = argv[host_spec+1]
|
||||||
|
except ValueError: # --host not specified
|
||||||
|
host = "127.0.0.1"
|
||||||
|
except IndexError: # flag given but no value
|
||||||
|
exit("thats not how this works, silly! --host 127.0.0.1")
|
||||||
|
|
||||||
|
try:
|
||||||
|
network = BBJ(host, port)
|
||||||
except URLError as e:
|
except URLError as e:
|
||||||
# print the connection error in red
|
# print the connection error in red
|
||||||
exit("\033[0;31m%s\033[0m" % repr(e))
|
exit("\033[0;31m%s\033[0m" % repr(e))
|
||||||
|
|
13
server.py
13
server.py
|
@ -520,5 +520,16 @@ if __name__ == "__main__":
|
||||||
except IndexError: # flag given but no value
|
except IndexError: # flag given but no value
|
||||||
exit("thats not how this works, silly! --port 7099")
|
exit("thats not how this works, silly! --port 7099")
|
||||||
|
|
||||||
cherrypy.config.update({'server.socket_port': int(port)})
|
try:
|
||||||
|
host_spec = argv.index("--host")
|
||||||
|
host = argv[host_spec+1]
|
||||||
|
except ValueError: # --host not specified
|
||||||
|
host = "127.0.0.1"
|
||||||
|
except IndexError: # flag given but no value
|
||||||
|
exit("thats not how this works, silly! --host 127.0.0.1")
|
||||||
|
|
||||||
|
cherrypy.config.update({
|
||||||
|
"server.socket_port": int(port),
|
||||||
|
"server.socket_host": host
|
||||||
|
})
|
||||||
run()
|
run()
|
||||||
|
|
Loading…
Reference in New Issue