Skip to content

Commit

Permalink
🧑‍💻 Check required env var before starting the server
Browse files Browse the repository at this point in the history
Closes #500
  • Loading branch information
baptisteArno committed May 12, 2023
1 parent bde9416 commit 45224f9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scripts/builder-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

ENVSH_ENV=./apps/builder/.env.production ENVSH_OUTPUT=./apps/builder/public/__env.js bash env.sh

echo 'Checking if required environment variables are set and valid...'

if [ -z "$DATABASE_URL" ]; then
echo "DATABASE_URL is not set. Exiting..."
exit 1
fi

if [ ${#ENCRYPTION_SECRET} -ne 32 ]; then
echo "ENCRYPTION_SECRET is not 32 characters long. Exiting... (To generate a valid secret: https://docs.typebot.io/self-hosting/docker#2-add-the-required-configuration)"
exit 1
fi

if [ -z "$NEXTAUTH_URL" ]; then
echo "NEXTAUTH_URL is not set. Exiting..."
exit 1
fi

if [ -z "$NEXT_PUBLIC_VIEWER_URL" ]; then
echo "NEXT_PUBLIC_VIEWER_URL is not set. Exiting..."
exit 1
fi

./node_modules/.bin/prisma generate --schema=packages/prisma/postgresql/schema.prisma;

echo 'Waiting 5s for db to be ready...';
Expand Down

0 comments on commit 45224f9

Please sign in to comment.