mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-17 14:08:29 +00:00
* fix for database url * correction * debug * corrections * corrections * changes in .env example file * corrections * corrections * changes for TOOLJET_DB_URL * corrections * naming corrections
25 lines
672 B
Bash
Executable file
25 lines
672 B
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
if [ -d "./server/dist" ]
|
|
then
|
|
SETUP_CMD='npm run db:setup:prod'
|
|
else
|
|
SETUP_CMD='npm run db:setup'
|
|
fi
|
|
|
|
if [ -f "./.env" ]
|
|
then
|
|
declare $(grep -v '^#' ./.env | xargs)
|
|
fi
|
|
|
|
if [ -z "$DATABASE_URL" ]
|
|
then
|
|
./server/scripts/wait-for-it.sh $PG_HOST:${PG_PORT:-5432} --strict --timeout=300 -- $SETUP_CMD
|
|
else
|
|
PG_HOST=$(echo "$DATABASE_URL" | sed -e 's/postgres:\/\///' -e 's/\([^@]*@\)\?//' | cut -d ':' -f 1)
|
|
PG_PORT=$(echo "$DATABASE_URL" | sed -e 's/postgres:\/\///' -e 's/\([^@]*@\)\?//' | cut -d ':' -f 2 | cut -d '/' -f 1)
|
|
./server/scripts/wait-for-it.sh "$PG_HOST:$PG_PORT" --strict --timeout=300 -- $SETUP_CMD
|
|
fi
|
|
|
|
exec "$@"
|