amend logic error in expose
This commit is contained in:
		
							parent
							
								
									7182f10c38
								
							
						
					
					
						commit
						278eee820b
					
				| 
						 | 
					@ -35,9 +35,9 @@ def run(
 | 
				
			||||||
        "ngrok", "--tunnel-service", help="Specify the tunnel service"
 | 
					        "ngrok", "--tunnel-service", help="Specify the tunnel service"
 | 
				
			||||||
    ),
 | 
					    ),
 | 
				
			||||||
    expose: str = typer.Option(
 | 
					    expose: str = typer.Option(
 | 
				
			||||||
        '', 
 | 
					        None, 
 | 
				
			||||||
        "--expose", 
 | 
					        "--expose", 
 | 
				
			||||||
        help="Expose localhost to internet with auth and optional custom domain if specified",
 | 
					        help="Expose localhost to internet. Optionally specify a custom domain.",
 | 
				
			||||||
    ),
 | 
					    ),
 | 
				
			||||||
    client: bool = typer.Option(False, "--client", help="Run client"),
 | 
					    client: bool = typer.Option(False, "--client", help="Run client"),
 | 
				
			||||||
    server_url: str = typer.Option(
 | 
					    server_url: str = typer.Option(
 | 
				
			||||||
| 
						 | 
					@ -92,7 +92,7 @@ def _run(
 | 
				
			||||||
    server_host: str = "0.0.0.0",
 | 
					    server_host: str = "0.0.0.0",
 | 
				
			||||||
    server_port: int = 10001,
 | 
					    server_port: int = 10001,
 | 
				
			||||||
    tunnel_service: str = "bore",
 | 
					    tunnel_service: str = "bore",
 | 
				
			||||||
    expose: str = '',
 | 
					    expose: str = None,
 | 
				
			||||||
    client: bool = False,
 | 
					    client: bool = False,
 | 
				
			||||||
    server_url: str = None,
 | 
					    server_url: str = None,
 | 
				
			||||||
    client_type: str = "auto",
 | 
					    client_type: str = "auto",
 | 
				
			||||||
| 
						 | 
					@ -162,9 +162,16 @@ def _run(
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        server_thread.start()
 | 
					        server_thread.start()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if expose:
 | 
					    if expose is not None:
 | 
				
			||||||
 | 
					        # `--expose` was passed
 | 
				
			||||||
 | 
					        if expose == '':
 | 
				
			||||||
 | 
					            # `--expose` was called without a custom domain
 | 
				
			||||||
 | 
					            # Autogenerate domain with ngrok
 | 
				
			||||||
 | 
					            expose = "unspecified"
 | 
				
			||||||
 | 
					        # else, `--expose was passed a custom domain`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        tunnel_thread = threading.Thread(
 | 
					        tunnel_thread = threading.Thread(
 | 
				
			||||||
            target=create_tunnel, args=[tunnel_service, server_host, server_port, qr]
 | 
					            target=create_tunnel, args=[tunnel_service, server_host, server_port, qr, expose]
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        tunnel_thread.start()
 | 
					        tunnel_thread.start()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue