@@ -12,8 +12,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# | |||
SCRIPT="${0}" | |||
SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) | |||
@@ -22,8 +22,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -14,8 +14,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -14,8 +14,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -14,8 +14,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -14,8 +14,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -14,8 +14,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -14,8 +14,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -12,8 +12,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_SCRIPTS : location of run.sh script. Default is to assume it is in the same directory containing this script | |||
# | |||
SCRIPT="${0}" | |||
@@ -16,8 +16,8 @@ | |||
# | |||
# BUBBLE_ENTITY : the filename that contains the JSON to send in the POST. If empty, entity is read from stdin | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -15,8 +15,8 @@ | |||
# | |||
# BUBBLE_ENTITY : the filename that contains the JSON to send in the POST. If empty, entity is read from stdin | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -16,8 +16,8 @@ | |||
# | |||
# BUBBLE_ENTITY : the filename that contains the JSON to send in the PUT. If empty, entity is read from stdin | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -15,8 +15,8 @@ | |||
# | |||
# BUBBLE_ENTITY : the filename that contains the JSON to send in the PUT. If empty, entity is read from stdi | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -15,8 +15,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from | |||
# bubble repo, bubble-models repo, or bubble-client and use include files from minimal model. | |||
# | |||
@@ -14,8 +14,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# BUBBLE_ENV : env file to load. Default is ~/.bubble.env or /home/bubble/api/bubble.env (whichever is found first) | |||
# DEBUG_PORT : if set, this is the port number the client will wait for a debugger to attach before starting | |||
# BUBBLE_INCLUDE : when using the sync-model and run-script commands, this is the directory to find included files | |||
@@ -13,8 +13,8 @@ | |||
# Environment variables | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# | |||
SCRIPT="${0}" | |||
SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) | |||
@@ -25,8 +25,8 @@ | |||
# Environment variables for API commands | |||
# | |||
# BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env) | |||
# BUBBLE_USER : account to use. Default is root | |||
# BUBBLE_PASS : password for account. Default is root | |||
# BUBBLE_USER : account to use. Default is root@local.local | |||
# BUBBLE_PASS : password for account. Default is password | |||
# | |||
# | |||
SCRIPT="${0}" | |||
@@ -124,50 +124,43 @@ else | |||
BUBBLE_CP="${BUBBLE_JAR}:${BUBBLE_ADDITIONAL_CLASSPATH}" | |||
fi | |||
# If BUBBLE_API is defined, we may have cached credentials | |||
BUBBLE_AUTH="${HOME}/.bubble_auth" | |||
if [[ ! -z "${BUBBLE_API}" && -d "${BUBBLE_AUTH}" ]] ; then | |||
if [[ -z "${BUBBLE_DISABLE_AUTH_CACHE}" || "${BUBBLE_DISABLE_AUTH_CACHE}" == "false" ]] ; then | |||
API_HOST="$(echo -n "${BUBBLE_API}" | awk -F '/' '{print $3}')" | |||
AUTH_DIR="${BUBBLE_AUTH}/${API_HOST}" | |||
USER_FILE="${AUTH_DIR}/user" | |||
PASS_FILE="${AUTH_DIR}/pass" | |||
if [[ ! -z "${BUBBLE_USER}" && -f "${AUTH_DIR}/${BUBBLE_USER}" ]] ; then | |||
if [[ -z "${BUBBLE_QUIET_AUTH_CACHE}" || "${BUBBLE_QUIET_AUTH_CACHE}" != "true" ]] ; then | |||
echo 1>&2 "Using cached password for user ${BUBBLE_USER} from ${AUTH_DIR}/${BUBBLE_USER} | |||
Set env var BUBBLE_DISABLE_AUTH_CACHE=true to disable this behavior | |||
Set BUBBLE_QUIET_AUTH_CACHE=true to hide this warning" | |||
fi | |||
BUBBLE_PASS="$(cat "${AUTH_DIR}/${BUBBLE_USER}" | tr -d '[:space:]')" | |||
elif [[ -f ${USER_FILE} && -f ${PASS_FILE} ]] ; then | |||
if [[ -z "${BUBBLE_QUIET_AUTH_CACHE}" || "${BUBBLE_QUIET_AUTH_CACHE}" != "true" ]] ; then | |||
echo 1>&2 "Using cached user/pass from ${USER_FILE} and ${PASS_FILE} | |||
Set env var BUBBLE_DISABLE_AUTH_CACHE=true to disable this behavior | |||
Set BUBBLE_QUIET_AUTH_CACHE=true to hide this warning" | |||
fi | |||
BUBBLE_USER="$(cat "${USER_FILE}" | tr -d '[:space:]')" | |||
BUBBLE_PASS="$(cat "${PASS_FILE}" | tr -d '[:space:]')" | |||
fi | |||
# Default user if none set | |||
if [[ -z "${BUBBLE_USER}" ]] ; then | |||
if [[ ! -z "${REQUIRE_BUBBLE_USER}" ]] ; then | |||
die "No BUBBLE_USER env var defined" | |||
fi | |||
BUBBLE_USER=root@local.local | |||
fi | |||
# Default password if none set | |||
if [[ -z "${BUBBLE_PASS}" ]] ; then | |||
# If BUBBLE_API is defined, we may have cached credentials | |||
BUBBLE_AUTH="${HOME}/.bubble_auth" | |||
if [[ ! -z "${BUBBLE_API}" && -d "${BUBBLE_AUTH}" ]] ; then | |||
if [[ -z "${BUBBLE_DISABLE_AUTH_CACHE}" || "${BUBBLE_DISABLE_AUTH_CACHE}" == "false" ]] ; then | |||
API_HOST="$(echo -n "${BUBBLE_API}" | awk -F '/' '{print $3}')" | |||
AUTH_DIR="${BUBBLE_AUTH}/${API_HOST}" | |||
PASS_FILE="${AUTH_DIR}/${BUBBLE_USER}" | |||
if [[ ! -z "${BUBBLE_USER}" && -f "${PASS_FILE}" ]] ; then | |||
if [[ -z "${BUBBLE_QUIET_AUTH_CACHE}" || "${BUBBLE_QUIET_AUTH_CACHE}" != "true" ]] ; then | |||
echo 1>&2 "Using cached password for user ${BUBBLE_USER} from ${AUTH_DIR}/${BUBBLE_USER} | |||
- Set env var BUBBLE_DISABLE_AUTH_CACHE=true to disable this behavior | |||
- Set env var BUBBLE_QUIET_AUTH_CACHE=true to hide this warning | |||
" | |||
fi | |||
BUBBLE_PASS="$(cat "${PASS_FILE}" | tr -d '[:space:]')" | |||
fi | |||
fi | |||
fi | |||
if [[ ! -z "${REQUIRE_BUBBLE_PASS}" ]] ; then | |||
die "No BUBBLE_PASS env var defined" | |||
fi | |||
echo 1>&2 "*** Warning: BUBBLE_PASS env var was not defined, using default password (probable authentication failure)" | |||
BUBBLE_PASS=password | |||
fi | |||
# Default user if none set | |||
if [[ -z "${BUBBLE_USER}" ]] ; then | |||
if [[ ! -z "${REQUIRE_BUBBLE_USER}" ]] ; then | |||
die "No BUBBLE_USER env var defined" | |||
fi | |||
BUBBLE_USER=root@local.local | |||
fi | |||
# Run! | |||
BUBBLE_JAR="${BUBBLE_JAR}" java ${LOG_CONFIG} ${BUBBLE_JVM_OPTS} ${debug} -server -cp "${BUBBLE_CP}" ${CLASS} ${command} "${@}" |