Explorar o código

fix import script to work remotely

Daniel Sheffield %!s(int64=3) %!d(string=hai) anos
pai
achega
42143d5cc0
Modificáronse 1 ficheiros con 10 adicións e 1 borrados
  1. 10 1
      grocery_transactions.sh

+ 10 - 1
grocery_transactions.sh

@@ -57,7 +57,16 @@ then
     usage 1>&2
     exit 1
 fi
-psql -d das <<EOF
+if [ -f db_credentials.py ]; then 
+    . db_credentials.py
+    HOST="-h ${HOST}"
+    PASSWORD=
+else
+    HOST=
+    PASSWORD=
+fi
+
+psql ${HOST} -d das <<EOF
 BEGIN;
 $(cat - )
 SELECT