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:
16
scripts/replace-placeholder.sh
Executable file
16
scripts/replace-placeholder.sh
Executable 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
|
||||
@@ -1,5 +0,0 @@
|
||||
# Find and replace placeholder values with runtime-specific environment values
|
||||
find apps/web/.next/ apps/web/public -type f |
|
||||
while read file; do
|
||||
sed -i "s|https://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER|$NEXT_PUBLIC_WEBAPP_URL|g" "$file"
|
||||
done
|
||||
@@ -1,7 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -x
|
||||
|
||||
scripts/replace-placeholders.sh
|
||||
# Replace the statically built BUILT_NEXT_PUBLIC_WEBAPP_URL with run-time NEXT_PUBLIC_WEBAPP_URL
|
||||
# NOTE: if these values are the same, this will be skipped.
|
||||
scripts/replace-placeholder.sh "$BUILT_NEXT_PUBLIC_WEBAPP_URL" "$NEXT_PUBLIC_WEBAPP_URL"
|
||||
|
||||
scripts/wait-for-it.sh ${DATABASE_HOST} -- echo "database is up"
|
||||
npx prisma migrate deploy --schema /calcom/packages/prisma/schema.prisma
|
||||
npx ts-node --transpile-only /calcom/packages/prisma/seed-app-store.ts
|
||||
|
||||
Reference in New Issue
Block a user