mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-26 01:03:35 +05:00
refactor: handle ports as ints as they are coming as ints from the KiauhSettings
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -55,7 +55,7 @@ def print_client_already_installed_dialog(name: str):
|
||||
print_back_footer()
|
||||
|
||||
|
||||
def print_client_port_select_dialog(name: str, port: str, ports_in_use: List[str]):
|
||||
def print_client_port_select_dialog(name: str, port: int, ports_in_use: List[int]):
|
||||
port = f"{COLOR_CYAN}{port}{RESET_FORMAT}"
|
||||
line1 = f"Please select the port, {name} should be served on."
|
||||
line2 = f"In case you need {name} to be served on a specific"
|
||||
|
||||
@@ -104,20 +104,18 @@ def install_client(client: BaseWebClient) -> None:
|
||||
install_client_cfg = get_confirm(question, allow_go_back=False)
|
||||
|
||||
settings = KiauhSettings()
|
||||
port = settings.get(client.name, "port")
|
||||
ports_in_use = read_ports_from_nginx_configs()
|
||||
port: int = settings.get(client.name, "port")
|
||||
ports_in_use: List[int] = read_ports_from_nginx_configs()
|
||||
|
||||
# check if configured port is a valid number and not in use already
|
||||
valid_port = is_valid_port(port, ports_in_use)
|
||||
while not valid_port:
|
||||
next_port = get_next_free_port(ports_in_use)
|
||||
print_client_port_select_dialog(client.display_name, next_port, ports_in_use)
|
||||
port = str(
|
||||
get_number_input(
|
||||
f"Configure {client.display_name} for port",
|
||||
min_count=int(next_port),
|
||||
default=next_port,
|
||||
)
|
||||
port = get_number_input(
|
||||
f"Configure {client.display_name} for port",
|
||||
min_count=int(next_port),
|
||||
default=next_port,
|
||||
)
|
||||
valid_port = is_valid_port(port, ports_in_use)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user