fix yq behavior with bind-mount config.yaml (#1968)
Co-authored-by: Thibault "bui" Koechlin <thibault@crowdsec.net>
This commit is contained in:
parent
943bb58086
commit
d986ae0ee5
|
@ -69,9 +69,10 @@ conf_set() {
|
||||||
else
|
else
|
||||||
YAML_FILE="$CONFIG_FILE"
|
YAML_FILE="$CONFIG_FILE"
|
||||||
fi
|
fi
|
||||||
YAML_CONTENT=$(cat "$YAML_FILE" 2>/dev/null || true)
|
if [ ! -f "$YAML_FILE" ]; then
|
||||||
NEW_CONTENT=$(echo "$YAML_CONTENT" | yq e "$1")
|
install -m 0600 /dev/null "$YAML_FILE"
|
||||||
echo "$NEW_CONTENT" | install -m 0600 /dev/stdin "$YAML_FILE"
|
fi
|
||||||
|
yq e "$1" -i "$YAML_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
# conf_set_if(): used to update the configuration
|
# conf_set_if(): used to update the configuration
|
||||||
|
|
Loading…
Reference in a new issue