Przeglądaj źródła

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

tags/v1.4.32
Jonathan Cobb 4 lat temu
rodzic
commit
4e03e6d4cc
17 zmienionych plików z 61 dodań i 68 usunięć
  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 Wyświetl plik

@@ -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)


+ 2
- 2
bin/bconst Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bdelete Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bget Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bgeti Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bgeti1 Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bgetn Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bgetn1 Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bmodel Wyświetl plik

@@ -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}"


+ 2
- 2
bin/bpost Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bposte Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bput Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bpute Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bscript Wyświetl plik

@@ -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.
#


+ 2
- 2
bin/bubble Wyświetl plik

@@ -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


+ 2
- 2
bin/bunlock Wyświetl plik

@@ -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)


+ 29
- 36
bin/run.sh Wyświetl plik

@@ -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} "${@}"

Ładowanie…
Anuluj
Zapisz