From 6e24f39918472799591941af682d7a2a83886e98 Mon Sep 17 00:00:00 2001 From: hartraft Date: Wed, 21 Dec 2022 11:44:51 +0100 Subject: [PATCH] Fix truncated placeholder replace From @dcdh https://github.com/nodeshift-blog-examples/frontend-containers/issues/3 --- start-nginx.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/start-nginx.sh b/start-nginx.sh index 0e9c790..5a5c777 100644 --- a/start-nginx.sh +++ b/start-nginx.sh @@ -1,7 +1,11 @@ -#!/usr/bin/env bash -export EXISTING_VARS=$(printenv | awk -F= '{print $1}' | sed 's/^/\$/g' | paste -sd,); +#!/usr/bin/env sh +export EXISTING_VARS=$(printenv | awk -F= '{print $1}' | sed 's/^/\$/g' | paste -sd,); for file in $JSFOLDER; do - cat $file | envsubst $EXISTING_VARS | tee $file + if [ ! -f $file.tmp ] + then + cp $file $file.tmp + fi + cat $file.tmp | envsubst $EXISTING_VARS | tee $file done nginx -g 'daemon off;'