Browse Source

update user/pass env var docs and default handling in run.sh

tags/v1.4.32
Jonathan Cobb 4 years ago
parent
commit
4e03e6d4cc
17 changed files with 61 additions and 68 deletions
  1. +2
    -2
      bin/bactivate
  2. +2
    -2
      bin/bconst
  3. +2
    -2
      bin/bdelete
  4. +2
    -2
      bin/bget
  5. +2
    -2
      bin/bgeti
  6. +2
    -2
      bin/bgeti1
  7. +2
    -2
      bin/bgetn
  8. +2
    -2
      bin/bgetn1
  9. +2
    -2
      bin/bmodel
  10. +2
    -2
      bin/bpost
  11. +2
    -2
      bin/bposte
  12. +2
    -2
      bin/bput
  13. +2
    -2
      bin/bpute
  14. +2
    -2
      bin/bscript
  15. +2
    -2
      bin/bubble
  16. +2
    -2
      bin/bunlock
  17. +29
    -36
      bin/run.sh

+ 2
- 2
bin/bactivate View File

@@ -12,8 +12,8 @@
# Environment variables # 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_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="${0}"
SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)


+ 2
- 2
bin/bconst View File

@@ -22,8 +22,8 @@
# Environment variables # 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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bdelete View File

@@ -14,8 +14,8 @@
# Environment variables # 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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bget View File

@@ -14,8 +14,8 @@
# Environment variables # 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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bgeti View File

@@ -14,8 +14,8 @@
# Environment variables # 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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bgeti1 View File

@@ -14,8 +14,8 @@
# Environment variables # 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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bgetn View File

@@ -14,8 +14,8 @@
# Environment variables # 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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bgetn1 View File

@@ -14,8 +14,8 @@
# Environment variables # 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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bmodel View File

@@ -12,8 +12,8 @@
# Environment variables # 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_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 # BUBBLE_SCRIPTS : location of run.sh script. Default is to assume it is in the same directory containing this script
# #
SCRIPT="${0}" SCRIPT="${0}"


+ 2
- 2
bin/bpost View File

@@ -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_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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bposte View File

@@ -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_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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bput View File

@@ -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_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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bpute View File

@@ -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_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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bscript View File

@@ -15,8 +15,8 @@
# Environment variables # 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_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_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. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
# #


+ 2
- 2
bin/bubble View File

@@ -14,8 +14,8 @@
# Environment variables # 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_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) # 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 # 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 # BUBBLE_INCLUDE : when using the sync-model and run-script commands, this is the directory to find included files


+ 2
- 2
bin/bunlock View File

@@ -13,8 +13,8 @@
# Environment variables # 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_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="${0}"
SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)


+ 29
- 36
bin/run.sh View File

@@ -25,8 +25,8 @@
# Environment variables for API commands # 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_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="${0}"
@@ -124,50 +124,43 @@ else
BUBBLE_CP="${BUBBLE_JAR}:${BUBBLE_ADDITIONAL_CLASSPATH}" BUBBLE_CP="${BUBBLE_JAR}:${BUBBLE_ADDITIONAL_CLASSPATH}"
fi 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 fi
BUBBLE_USER=root@local.local
fi fi


# Default password if none set # Default password if none set
if [[ -z "${BUBBLE_PASS}" ]] ; then 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 if [[ ! -z "${REQUIRE_BUBBLE_PASS}" ]] ; then
die "No BUBBLE_PASS env var defined" die "No BUBBLE_PASS env var defined"
fi fi
echo 1>&2 "*** Warning: BUBBLE_PASS env var was not defined, using default password (probable authentication failure)"
BUBBLE_PASS=password BUBBLE_PASS=password
fi 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! # Run!
BUBBLE_JAR="${BUBBLE_JAR}" java ${LOG_CONFIG} ${BUBBLE_JVM_OPTS} ${debug} -server -cp "${BUBBLE_CP}" ${CLASS} ${command} "${@}" BUBBLE_JAR="${BUBBLE_JAR}" java ${LOG_CONFIG} ${BUBBLE_JVM_OPTS} ${debug} -server -cp "${BUBBLE_CP}" ${CLASS} ${command} "${@}"

Loading…
Cancel
Save