From d986ae0ee5019272f5ee2936b33e3b9aaa62c6e6 Mon Sep 17 00:00:00 2001 From: mmetc <92726601+mmetc@users.noreply.github.com> Date: Mon, 9 Jan 2023 21:47:25 +0100 Subject: [PATCH] fix yq behavior with bind-mount config.yaml (#1968) Co-authored-by: Thibault "bui" Koechlin --- docker/docker_start.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker/docker_start.sh b/docker/docker_start.sh index 11833a049..60fcb6792 100755 --- a/docker/docker_start.sh +++ b/docker/docker_start.sh @@ -69,9 +69,10 @@ conf_set() { else YAML_FILE="$CONFIG_FILE" fi - YAML_CONTENT=$(cat "$YAML_FILE" 2>/dev/null || true) - NEW_CONTENT=$(echo "$YAML_CONTENT" | yq e "$1") - echo "$NEW_CONTENT" | install -m 0600 /dev/stdin "$YAML_FILE" + if [ ! -f "$YAML_FILE" ]; then + install -m 0600 /dev/null "$YAML_FILE" + fi + yq e "$1" -i "$YAML_FILE" } # conf_set_if(): used to update the configuration