diff scripts/.functions.sh @ 163:daf91a3bbee5 production v1.2.0

flow: Merged <release> 'v1.2.0' to <master> ('production').
author smith@nwoca.org
date Tue, 15 Aug 2017 21:59:23 +0100
parents 018f62da1931
children 1a8087653f2a
line wrap: on
line diff
--- a/scripts/.functions.sh	Fri Jun 16 17:14:15 2017 +0100
+++ b/scripts/.functions.sh	Tue Aug 15 21:59:23 2017 +0100
@@ -1,4 +1,17 @@
 #!/bin/bash
+getScriptDir() {
+     SOURCE="${BASH_SOURCE[0]}"
+     while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
+     echo $( cd $( dirname $SOURCE) && pwd )
+}
+
+if [ "$SSDT_HOME" == "" ]
+then
+   export SSDT_SCRIPTS=$(getScriptDir)
+   export SSDT_HOME=$(dirname $SSDT_SCRIPTS)
+fi
+
+export SSDT_DOCKER_VERSION=$(docker version --format '{{.Server.Version}}')
 
 # deletes psql data from specified service
 resetDbVolume() {
@@ -26,4 +39,10 @@
    container=$(composeGetContainer $service)
 
    echo "$2" | docker exec -i $container  sh -c "gosu postgres psql \$DB_NAME"
-}
\ No newline at end of file
+}
+
+composeGetProject() {  
+  service=${1?"Must supply service from current project"}
+  container=$(composeGetContainer $service)
+  echo $(docker inspect -f '{{index .Config.Labels "com.docker.compose.project" }}' $container)
+}