add override configuration file option to builder.sh
authorMatteo Nastasi <nastasi@alternativeoutput.it>
Tue, 8 Oct 2019 07:19:19 +0000 (09:19 +0200)
committerMatteo Nastasi <nastasi@alternativeoutput.it>
Tue, 8 Oct 2019 20:49:06 +0000 (22:49 +0200)
sql/builder.sh

index f67fa23..16dafab 100755 (executable)
@@ -8,7 +8,7 @@ DATECUR="$(date +%s)"
 #  functions
 usage () {
     echo " USAGE"
-    echo "   $0 <command> [-d|--dryrun] [<-a|--allfiles>|<-p|--devfiles>] [-s|--short] ..."
+    echo "   $0 <command> [-c|--config <override_file>] [-d|--dryrun] [<-a|--allfiles>|<-p|--devfiles>] [-s|--short] ..."
     echo "   $0 <-h|--help|help>"
     echo "   commands are:"
     echo "       create"
@@ -77,6 +77,10 @@ shift
 
 while [ $# -gt 0 ]; do
     case $1 in
+        -c|--config)
+            CONFIG_FILE=$2
+            shift
+            ;;
         -d|--dryrun)
             DRY_RUN=y
             psql () {
@@ -117,6 +121,10 @@ if [ -f $HOME/.brisk_install ]; then
     source $HOME/.brisk_install
 fi
 
+if [ -f "$CONFIG_FILE" ]; then
+    source "$CONFIG_FILE"
+fi
+
 pg_args=""
 test "$DBHOST" != "" && pg_args="$pg_args -h $DBHOST"
 test "$DBUSER" != "" && pg_args="$pg_args -U $DBUSER"