From 47b0c354415750c0b297c2aa960b1269b4cb9eb8 Mon Sep 17 00:00:00 2001 From: josc146 Date: Sat, 4 Nov 2023 20:22:28 +0800 Subject: [PATCH] update ngrok_connect --- backend-python/utils/ngrok.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend-python/utils/ngrok.py b/backend-python/utils/ngrok.py index c697009..ec70d29 100644 --- a/backend-python/utils/ngrok.py +++ b/backend-python/utils/ngrok.py @@ -1,11 +1,13 @@ import os -import sys +import global_var def ngrok_connect(): from pyngrok import ngrok, conf - conf.set_default(conf.PyngrokConfig(ngrok_path="./ngrok")) + conf.set_default( + conf.PyngrokConfig(ngrok_path="./ngrok.exe" if os.name == "nt" else "./ngrok") + ) ngrok.set_auth_token(os.environ["ngrok_token"]) - http_tunnel = ngrok.connect(8000 if len(sys.argv) == 1 else int(sys.argv[1])) - print(http_tunnel.public_url) + http_tunnel = ngrok.connect(global_var.get(global_var.Args).port) + print(f"ngrok url: {http_tunnel.public_url}")