Commit 92eaa227 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[UTIL] psql refactored

parent 585d78b4
Pipeline #2176 failed with stage
in 10 minutes and 18 seconds
#!/bin/bash
if [[ $1 == "" ]]
then echo "USAGE : ./psql gargantext.ini"
else
getter () {
grep $2 $1 | sed "s/^.*= //"
}
USER=$(getter $1 "DB_USER")
NAME=$(getter $1 "DB_NAME")
INIFILE=$1
PASS=$(getter $1 "DB_PASS")
HOST=$(getter $1 "DB_HOST")
PORT=$(getter $1 "DB_PORT")
getter () {
grep $1 $INIFILE | sed "s/^.*= //"
}
connect () {
USER=$(getter "DB_USER")
NAME=$(getter "DB_NAME")
PASS=$(getter "DB_PASS")
HOST=$(getter "DB_HOST")
PORT=$(getter "DB_PORT")
psql "postgresql://${USER}:${PASS}@${HOST}:${PORT}/${NAME}"
}
psql "postgresql://${USER}:${PASS}@${HOST}:${PORT}/${NAME}"
if [[ $1 == "" ]]
then echo "USAGE : ./psql gargantext.ini"
else connect $1
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment