Minor envsubst improvements. #746
@ -33,8 +33,8 @@ if [ -f ".env" ]; then
|
|||||||
rm -f $TMP_ENV
|
rm -f $TMP_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for f in $(find "$TRG_DIR" -regex ".*.[tj]sx?$" -type f | grep -v 'node_modules'); do
|
for f in $(find . -type f \( -regex '.*.html?' -or -regex ".*.[tj]s\(x\|on\)?$" \) | grep -v 'node_modules' | grep -v '.git'); do
|
||||||
for e in $(cat "${f}" | tr -s '[:blank:]' '\n' | tr -s '[{},();]' '\n' | egrep -o '^"CERC_RUNTIME_ENV_[^\"]+"'); do
|
for e in $(cat "${f}" | tr -s '[:blank:]' '\n' | tr -s '["/\\{},();]' '\n' | tr -s "[']" '\n' | egrep -o -e '^CERC_RUNTIME_ENV_.+$' -e '^LACONIC_HOSTED_CONFIG_.+$'); do
|
||||||
orig_name=$(echo -n "${e}" | sed 's/"//g')
|
orig_name=$(echo -n "${e}" | sed 's/"//g')
|
||||||
cur_name=$(echo -n "${orig_name}" | sed 's/CERC_RUNTIME_ENV_//g')
|
cur_name=$(echo -n "${orig_name}" | sed 's/CERC_RUNTIME_ENV_//g')
|
||||||
cur_val=$(echo -n "\$${cur_name}" | envsubst)
|
cur_val=$(echo -n "\$${cur_name}" | envsubst)
|
||||||
|
@ -18,8 +18,8 @@ if [ -f ".env" ]; then
|
|||||||
rm -f $TMP_ENV
|
rm -f $TMP_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for f in $(find . -regex ".*.[tj]sx?$" -type f | grep -v 'node_modules'); do
|
for f in $(find . -type f \( -regex '.*.html?' -or -regex ".*.[tj]s\(x\|on\)?$" \) | grep -v 'node_modules' | grep -v '.git'); do
|
||||||
for e in $(cat "${f}" | tr -s '[:blank:]' '\n' | tr -s '[{},();]' '\n' | egrep -o -e '^"CERC_RUNTIME_ENV_[^\"]+"' -e '^"LACONIC_HOSTED_CONFIG_[^\"]+"'); do
|
for e in $(cat "${f}" | tr -s '[:blank:]' '\n' | tr -s '["/\\{},();]' '\n' | tr -s "[']" '\n' | egrep -o -e '^CERC_RUNTIME_ENV_.+$' -e '^LACONIC_HOSTED_CONFIG_.+$'); do
|
||||||
orig_name=$(echo -n "${e}" | sed 's/"//g')
|
orig_name=$(echo -n "${e}" | sed 's/"//g')
|
||||||
cur_name=$(echo -n "${orig_name}" | sed 's/CERC_RUNTIME_ENV_//g')
|
cur_name=$(echo -n "${orig_name}" | sed 's/CERC_RUNTIME_ENV_//g')
|
||||||
cur_val=$(echo -n "\$${cur_name}" | envsubst)
|
cur_val=$(echo -n "\$${cur_name}" | envsubst)
|
||||||
|
@ -33,4 +33,10 @@ else
|
|||||||
mv "${WORK_DIR}" "${DEST_DIR}"
|
mv "${WORK_DIR}" "${DEST_DIR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# One special fix ...
|
||||||
|
cd "${DEST_DIR}"
|
||||||
|
for f in $(find . -type f -name '*.htm*'); do
|
||||||
|
sed -i -e 's#/LACONIC_HOSTED_CONFIG_homepage/#LACONIC_HOSTED_CONFIG_homepage/#g' "$f"
|
||||||
|
done
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user