Skip to content

Commit 2dca46b

Browse files
committed
fixes
1 parent f376a49 commit 2dca46b

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

bota/src/bota/vm.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,14 @@ def install_desktop_app_in_vm(
570570

571571
click.echo("Successfully installed the Desktop App.")
572572
click.echo("Now, Checking API Status...")
573-
ip = get_vm_ip()
573+
574+
ip = f"127.0.0.1:{port}" if skip_apache_request_routing else get_vm_ip()
574575
wait_till_desktop_api_up(ip, api_base_path)
575-
click.echo(f"Hurray! your desktop app is up and running. Visit http://{ip}{api_base_path or '/'} to see the API Docs.")
576+
577+
if skip_apache_request_routing:
578+
click.echo(f"Hurray! your desktop app is up and running at http://{ip}{api_base_path or '/'}")
579+
else:
580+
click.echo(f"Hurray! your desktop app is up and running. Visit http://{ip}{api_base_path or '/'} to see the API Docs.")
576581

577582
def clean_base_path(api_base_path):
578583
api_base_path = os.path.normpath(api_base_path) if api_base_path else ""
@@ -590,14 +595,27 @@ def delete_installer(default_name):
590595
if os.path.exists(default_name):
591596
os.remove(default_name)
592597

598+
def read_file(path):
599+
with open(path, 'r', encoding="utf-8") as fp:
600+
content = fp.read()
601+
return content
602+
603+
def read_conf():
604+
return read_file("/etc/apache2/sites-available/000-default.conf")
605+
606+
607+
def make_apache_content():
608+
return read_file("/etc/apache2/sites-available/000-default.conf")
609+
593610
def setup_apache_load_balancer_desktop_app(port, api_base_path):
611+
root_path = api_base_path or '/'
594612
apache_conf = f"""<VirtualHost *:80>
595613
ServerAdmin webmaster@localhost
596614
DocumentRoot /var/www/html
597615
ErrorLog ${{APACHE_LOG_DIR}}/error.log
598616
CustomLog ${{APACHE_LOG_DIR}}/access.log combined
599-
ProxyPass {api_base_path or '/'} http://127.0.0.1:{port}{api_base_path or '/'}
600-
ProxyPassReverse {api_base_path or '/'} http://127.0.0.1:{port}{api_base_path or '/'}
617+
ProxyPass {root_path} http://127.0.0.1:{port}{root_path}
618+
ProxyPassReverse {root_path} http://127.0.0.1:{port}{root_path}
601619
</VirtualHost>"""
602620
write_file_sudo(apache_conf, "/etc/apache2/sites-available/000-default.conf")
603621

0 commit comments

Comments
 (0)