Support both build-time and run-time values for WEBAPP_URL. Improve re-build time, if just the WEBAPP_URL is changed.

This commit is contained in:
Connery Noble
2022-09-29 12:31:58 -07:00
parent 46a0e729db
commit 72005db13d
5 changed files with 32 additions and 10 deletions

16
scripts/replace-placeholder.sh Executable file
View File

@@ -0,0 +1,16 @@
FROM=$1
TO=$2
if [ "${FROM}" = "${TO}" ]; then
echo "Nothing to replace, the value is already set to ${TO}."
exit 0
fi
# Only peform action if $FROM and $TO are different.
echo "Replacing all statically built instances of $FROM with $TO."
find apps/web/.next/ apps/web/public -type f |
while read file; do
sed -i "s|$FROM|$TO|g" "$file"
done