psql 490 Bytes
Newer Older
1 2
#!/bin/bash

3 4 5 6 7

if [[ $1 == "" ]]
then echo "USAGE : ./psql gargantext.ini"
else 

8
INIFILE=$1
9

10 11 12
getter () {
  grep $1 $INIFILE | sed "s/^.*= //"
}
13

14 15 16 17 18
USER=$(getter "DB_USER")
NAME=$(getter "DB_NAME")
PASS=$(getter "DB_PASS")
HOST=$(getter "DB_HOST")
PORT=$(getter "DB_PORT")
19 20 21 22 23 24 25

# "postgresql://${USER}:${PASS}@${HOST}:${PORT}/${NAME}"

GARGDB="postgresql://${USER}:${PASS}@${HOST}:${PORT}/${NAME}"

#echo "connecting to $GARGDB"

26
psql "postgresql://${USER}:${PASS}@${HOST}:${PORT}/${NAME}"
27

28
fi
29 30


31