RWKV-Runner/backend-python/utils/ngrok.py

12 lines
312 B
Python
Raw Normal View History

2023-05-07 17:27:54 +08:00
import os
2023-05-20 15:33:38 +08:00
import sys
2023-05-07 17:27:54 +08:00
def ngrok_connect():
from pyngrok import ngrok, conf
2023-05-17 11:39:00 +08:00
2023-05-07 17:27:54 +08:00
conf.set_default(conf.PyngrokConfig(ngrok_path="./ngrok"))
ngrok.set_auth_token(os.environ["ngrok_token"])
2023-05-20 15:33:38 +08:00
http_tunnel = ngrok.connect(8000 if len(sys.argv) == 1 else int(sys.argv[1]))
2023-05-07 17:27:54 +08:00
print(http_tunnel.public_url)