Browse Source

Magic env handling to make it easier to jump in

Kevin van Zonneveld 9 years ago
parent
commit
8ac380705e
1 changed files with 13 additions and 0 deletions
  1. 13 0
      bin/test-acceptance

+ 13 - 0
bin/test-acceptance

@@ -8,6 +8,19 @@ set -o nounset
 __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
 __file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
 __base="$(basename ${__file} .sh)"
+__root="$(cd "$(dirname "${__dir}")" && pwd)"
+
+if [ ! -f "${__root}/env.sh" ]; then
+  cp "${__root}/env.example.sh" "${__root}/env.sh"
+fi
+if [ -n "${UPPYSERVER_DROPBOX_KEY:-}" ] && [ "${UPPYSERVER_DROPBOX_KEY:-***}" != "***" ]; then
+  source "${__root}/env.sh"
+fi
+if [ "${UPPYSERVER_DROPBOX_KEY:-***}" = "***" ]; then
+  echo "Env var UPPYSERVER_DROPBOX_KEY still had the example value '***'. "
+  echo "Please save the actual secrets in '${__root}/env.sh' and try again"
+  exit 1
+fi
 
 function killProcessListeningOnPort () {
   local port="${1}"