From 4412a1c844bc40967857d65c583720873f7ef211 Mon Sep 17 00:00:00 2001 From: Son Date: Tue, 21 May 2024 10:48:07 -0400 Subject: [PATCH] chart: use while IFS over content instead of sed --- charts/sogo/templates/deployment.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/charts/sogo/templates/deployment.yaml b/charts/sogo/templates/deployment.yaml index 4bf7458..44cc518 100644 --- a/charts/sogo/templates/deployment.yaml +++ b/charts/sogo/templates/deployment.yaml @@ -252,10 +252,13 @@ spec: # Get the filename without the directory path filename=$(basename "$file") # Read the content of the file and indent each line with two spaces - content=$(sed 's/^/ /' "$file") + content=$(cat "$file") # Append the filename and content to the YAML file if the content is not empty if [ -n "$content" ]; then - echo -e "$filename: |-\n$content" >> "$output_file" + echo "$filename: |-" >> "$output_file" + while IFS= read -r line; do + echo " $line" >> "$output_file" + done <<< "$content" fi done EOF