From 0bdf27d7dc2bd73d7872c25818e349286b19ddcc Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Tue, 12 Sep 2023 15:44:57 +0200 Subject: [PATCH] fix: [vps] improve detection of ``compose.yml`` path --- bin/vps | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/vps b/bin/vps index 506c51c..89ce39e 100755 --- a/bin/vps +++ b/bin/vps @@ -79,9 +79,8 @@ compose:get-compose-yml() { :cache: scope=session local path - [ -e "/etc/compose/local.conf" ] && . "/etc/compose/local.conf" - path=${DEFAULT_COMPOSE_FILE:-/etc/compose/compose.yml} + path=$(DEBUG=1 DRY_RUN=1 compose 2>&1 | egrep '^\s+-e HOST_COMPOSE_YML_FILE=' | cut -f 2- -d "=" | cut -f 1 -d " ") [ -e "$path" ] || return 1 echo "$path" @@ -99,7 +98,12 @@ compose:has-container-project-myc() { compose:file:value-change() { local key="$1" value="$2" - yaml:file:value-change "$(compose:get-compose-yml)" "$key" "$value" || exit 1 + local compose_yml + if ! compose_yml=$(compose:get-compose-yml); then + err "Couldn't locate your 'compose.yml' file." + return 1 + fi + yaml:file:value-change "$compose_yml" "$key" "$value" || return 1 } export -f compose:file:value-change