mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
* Fix for entrypoint.sh file take default port value 5432 in database_url * Added information about database_url in docs * mentioning what variable needs to be given when passing string * fix for lint issue in ci * fixing syntax errors
25 lines
606 B
Bash
Executable file
25 lines
606 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" | awk -F[@/:] '{print $4}')
|
|
PG_PORT=$(echo "$DATABASE_URL" | awk -F'[@/]' '{split($5,a,":"); print a[2] ? a[2] : "5432"}')
|
|
./server/scripts/wait-for-it.sh "$PG_HOST:$PG_PORT" --strict --timeout=300 -- $SETUP_CMD
|
|
fi
|
|
|
|
exec "$@"
|