Browse Source

fix: dev: improve compatibility outside of VPS layouts

journalctl_limit
Valentin Lab 1 year ago
parent
commit
4b99efdff5
  1. 17
      bin/vps

17
bin/vps

@ -688,11 +688,22 @@ export -f compose:charm:container_first
compose:get_url() { compose:get_url() {
local project_name="$1" service="$2" data_file network ip local project_name="$1" service="$2" data_file network ip
data_file="/var/lib/compose/relations/${project_name}/${service}-frontend/web-proxy/data"
if [ -e "$data_file" ]; then
data_dir=("/var/lib/compose/relations/${project_name}/${service}-"*"/web-proxy")
if [ "${#data_dir[@]}" -gt 1 ]; then
err "More than one web-proxy relation." \
"Current 'vps' algorithm is insufficient" \
"to figure out which relation is concerned"
return 1
fi
data_file="${data_dir[0]}/data"
if [ -d "${data_file%/*}" ]; then
( (
set -o pipefail set -o pipefail
cat "$data_file" | shyaml get-value url
## users can't cat directly the content
docker run --rm \
-v "${data_file%/*}":/tmp/dummy alpine \
cat "/tmp/dummy/${data_file##*/}" |
shyaml get-value url
) )
else else
## Assume there are no frontend relation here, the url is direct IP ## Assume there are no frontend relation here, the url is direct IP

Loading…
Cancel
Save