From 2a26c7576427dd666ec142b53249cffd74628171 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Fri, 18 Mar 2022 12:01:37 +0100 Subject: [PATCH] fix: [vps] support of services not using a frontend to command requiring url Signed-off-by: Valentin Lab --- bin/vps | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/vps b/bin/vps index 8dfb8c7..f204b72 100755 --- a/bin/vps +++ b/bin/vps @@ -597,7 +597,16 @@ compose:get_url() { container_id=$(compose:service:container_one "${project_name}" "${service}") || return 1 network_ip=$(docker:container:network_ip_one "${container_id}") || return 1 IFS=":" read -r network ip <<<"$network_ip" - echo "http://$ip" + tcp_port= + for port in $(docker:exposed_ports "$container_id"); do + IFS="/" read port type <<<"$port" + [ "$type" == "tcp" ] || continue + tcp_port="$port" + break + done + + echo -n "http://$ip" + [ -n "$tcp_port" ] && echo ":$tcp_port" fi || { err "Failed querying ${service} to frontend relation to get url." return 1