Skip to content

Commit 58f71fb

Browse files
committed
fix: hostname and port arguments for https server
1 parent 914b5b1 commit 58f71fb

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

python/libs/https/main.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@
1111

1212
if __name__ == "__main__":
1313
parser = argparse.ArgumentParser()
14+
parser.add_argument(
15+
"--hostname",
16+
type=str,
17+
default="127.0.0.1",
18+
help="Which host name to run the server on.",
19+
)
1420
parser.add_argument(
1521
"--port",
16-
"-p",
1722
type=int,
1823
default=8000,
1924
help="Which port to run the server on.",
@@ -23,13 +28,15 @@
2328
cert_path = os.path.join(lib_path, "cert.pem")
2429
key_path = os.path.join(lib_path, "key.pem")
2530

26-
host = "127.0.0.1"
27-
port = 8000 if not args.port else args.port
31+
print(args)
32+
host = args.hostname
33+
port = args.port
34+
2835
httpd = http.server.HTTPServer((host, port), http.server.SimpleHTTPRequestHandler)
2936

3037
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
3138
context.load_cert_chain(certfile=cert_path, keyfile=key_path)
3239

3340
httpd.socket = context.wrap_socket(httpd.socket, server_side=True)
34-
print(f"HTTPS server started @ https://127.0.0.1:{port}")
41+
print(f"HTTPS server started @ https://{host}:{port}")
3542
httpd.serve_forever()

python/mod.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export BPY="$BPY_BIN/python3"
1212
export BPIP="$BPY_BIN/python3 -m pip"
1313
export BVENV="$BPY_BIN/activate"
1414

15-
LD_LIBRARY_PATH=$("$BPY" -c 'import os; import nvidia.cublas.lib; import nvidia.cudnn.lib; print(os.path.dirname(nvidia.cublas.lib.__file__) + ":" + os.path.dirname(nvidia.cudnn.lib.__file__))')
16-
export LD_LIBRARY_PATH
15+
#LD_LIBRARY_PATH=$("$BPY" -c 'import os; import nvidia.cublas.lib; import nvidia.cudnn.lib; print(os.path.dirname(nvidia.cublas.lib.__file__) + ":" + os.path.dirname(nvidia.cudnn.lib.__file__))')
16+
#export LD_LIBRARY_PATH
1717

1818
# Bashful Python
1919
function bpy() {
@@ -36,7 +36,7 @@ function bpy.http() {
3636
function bpy.https() {
3737
lib_dir="$BASHFUL_DIR/python/libs/https"
3838
lib_main="main.py"
39-
bpy "$lib_dir/$lib_main"
39+
bpy "$lib_dir/$lib_main" "$@"
4040
}
4141

4242
# Simple Local Only (GPU and/or CPU) LLM runner

0 commit comments

Comments
 (0)