feat: Bench command to open ngrok tunnel (#11024)
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
This commit is contained in:
parent
31b0e81629
commit
434c892ac0
2 changed files with 28 additions and 3 deletions
|
|
@ -631,6 +631,29 @@ def stop_recording(context):
|
|||
if not context.sites:
|
||||
raise SiteNotSpecifiedError
|
||||
|
||||
@click.command('ngrok')
|
||||
@pass_context
|
||||
def start_ngrok(context):
|
||||
from pyngrok import ngrok
|
||||
|
||||
site = get_site(context)
|
||||
frappe.init(site=site)
|
||||
|
||||
port = frappe.conf.http_port or frappe.conf.webserver_port
|
||||
public_url = ngrok.connect(port=port, options={
|
||||
'host_header': site
|
||||
})
|
||||
print(f'Public URL: {public_url}')
|
||||
print('Inspect logs at http://localhost:4040')
|
||||
|
||||
ngrok_process = ngrok.get_ngrok_process()
|
||||
try:
|
||||
# Block until CTRL-C or some other terminating event
|
||||
ngrok_process.proc.wait()
|
||||
except KeyboardInterrupt:
|
||||
print("Shutting down server...")
|
||||
frappe.destroy()
|
||||
ngrok.kill()
|
||||
|
||||
commands = [
|
||||
add_system_manager,
|
||||
|
|
@ -656,5 +679,6 @@ commands = [
|
|||
browse,
|
||||
start_recording,
|
||||
stop_recording,
|
||||
add_to_hosts
|
||||
add_to_hosts,
|
||||
start_ngrok
|
||||
]
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ dropbox==9.1.0
|
|||
email-reply-parser==0.5.9
|
||||
Faker==2.0.4
|
||||
future==0.18.2
|
||||
GitPython==2.1.15
|
||||
gitdb2==2.0.6;python_version<'3.4'
|
||||
GitPython==2.1.15
|
||||
google-api-python-client==1.9.3
|
||||
google-auth-httplib2==0.0.3
|
||||
google-auth-oauthlib==0.4.1
|
||||
|
|
@ -40,6 +40,7 @@ psycopg2-binary==2.8.4
|
|||
pyasn1==0.4.8
|
||||
PyJWT==1.7.1
|
||||
PyMySQL==0.9.3
|
||||
pyngrok==4.1.6
|
||||
pyOpenSSL==19.1.0
|
||||
pyotp==2.3.0
|
||||
PyPDF2==1.26.0
|
||||
|
|
@ -64,6 +65,6 @@ unittest-xml-reporting==2.5.2
|
|||
urllib3==1.25.8
|
||||
watchdog==0.8.0
|
||||
Werkzeug==0.16.1
|
||||
Whoosh==2.7.4
|
||||
xlrd==1.2.0
|
||||
zxcvbn-python==4.4.24
|
||||
Whoosh==2.7.4
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue