File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -3,5 +3,5 @@ MAINTAINER Dennis Coldwell <dennis.coldwell@gmail.com>
3
3
RUN apt-get -y update && apt-get -y install libpq-dev build-essential
4
4
RUN pip install pgcli==0.20.1
5
5
ADD run-pgcli.sh /bin/run-pgcli.sh
6
- CMD ["run-pgcli.sh" ]
6
+ ENTRYPOINT ["run-pgcli.sh" ]
7
7
Original file line number Diff line number Diff line change 3
3
# Simple wrapper for the pgli tool. This script allows us to pull in linked
4
4
# docker containers if the user decides to bring up the cli that way.
5
5
6
- if [ -z ${POSTGRES_PORT_5432_TCP_ADDR+x} ]; then
7
- # POSTGRES linked variables aren't set, just call pgcli without params
8
- pgcli
9
- else
6
+ db_url=$1
7
+
8
+ if [ -n " $db_url " ]; then
9
+ # 1st priority goes to any argument passed to the script
10
+ pgcli " $db_url "
11
+ elif [ -n " $DB_URL " ]; then
12
+ # next, if a DB_URL environment variable is set, use that
13
+ pgcli " $DB_URL "
14
+ elif [ -n " $POSTGRES_PORT_5432_TCP_ADDR " ]; then
15
+ # if nothing is set, we try to construct a db_url from the env vars that docker
16
+ # automatically sets for the postgres container
10
17
pgcli postgres://$POSTGRES_ENV_POSTGRES_USER :$POSTGRES_ENV_POSTGRES_PASSWORD @$POSTGRES_PORT_5432_TCP_ADDR :$POSTGRES_PORT_5432_TCP_PORT
18
+ else
19
+ echo " Database URL not provided, please try again."
11
20
fi
12
21
You can’t perform that action at this time.
0 commit comments