Skip to content
Snippets Groups Projects
Unverified Commit 6f274cdb authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Fix start script not accepting non-localhost params (#4770)

* Fix start script not accepting non-localhost params

* CR

* change logic for parsing

* removed env parsing
parent 8650e494
Branches
Tags
No related merge requests found
#!/usr/bin/env bash #!/usr/bin/env bash
PORT="${PORT:=3000}" PORT="${PORT:=3000}"
PGHOST=postgres
PGPORT=5432 # Parse Rails DATABASE and REDIS urls to get host and port
RSHOST=redis TXADDR=${DATABASE_URL/*:\/\/}
RSPORT=6379 TXADDR=${TXADDR/*@/}
TXADDR=${TXADDR/\/*/}
IFS=: TXADDR=($TXADDR) IFS=' '
PGHOST=${TXADDR[0]}
PGPORT=${TXADDR[1]:-5432}
TXADDR=${REDIS_URL/*:\/\/}
TXADDR=${TXADDR/*@/}
TXADDR=${TXADDR/\/*/}
IFS=: TXADDR=($TXADDR) IFS=' '
RDHOST=${TXADDR[0]}
RDPORT=${TXADDR[1]:-6379}
echo "Greenlight-v3 starting on port: $PORT" echo "Greenlight-v3 starting on port: $PORT"
echo $PGHOST
echo $PGPORT
echo $RDHOST
echo $RDPORT
if [ "$RAILS_ENV" = "production" ]; then if [ "$RAILS_ENV" = "production" ]; then
while ! nc -zw3 $PGHOST $PGPORT while ! nc -zw3 $PGHOST $PGPORT
...@@ -16,7 +32,7 @@ if [ "$RAILS_ENV" = "production" ]; then ...@@ -16,7 +32,7 @@ if [ "$RAILS_ENV" = "production" ]; then
sleep 1 sleep 1
done done
while ! nc -zw3 $RSHOST $RSPORT while ! nc -zw3 $RDHOST $RDPORT
do do
echo "Waiting for redis to start up ..." echo "Waiting for redis to start up ..."
sleep 1 sleep 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment