]> Git — Sourcephile - gargantext.git/blob - bin/psql
[CONFIG] fixing default config (and removing spaces at end of lines)
[gargantext.git] / bin / psql
1 #!/bin/bash
2
3 INIFILE=$1
4
5 getter () {
6 grep $1 $INIFILE | sed "s/^.*= //"
7 }
8
9 connect () {
10 USER=$(getter "DB_USER")
11 NAME=$(getter "DB_NAME")
12 PASS=$(getter "DB_PASS")
13 HOST=$(getter "DB_HOST")
14 PORT=$(getter "DB_PORT")
15 psql "postgresql://${USER}:${PASS}@${HOST}:${PORT}/${NAME}"
16 }
17
18 if [[ $1 == "" ]]
19 then echo "USAGE : ./psql gargantext.ini"
20 else connect $INIFILE
21 fi
22
23
24