diff options
author | Will Holley <willholley@gmail.com> | 2019-12-11 14:56:27 +0000 |
---|---|---|
committer | Will Holley <willholley@gmail.com> | 2019-12-16 07:51:41 +0000 |
commit | 4ddb8757d699114e84031f6aa8007ea80a51c66e (patch) | |
tree | a4c01c3f512e98ebdc2ff0d706e5b3061a9a7915 | |
parent | 4fd0f2644a1d755bae8b8f8b85bae0e8e13cddc4 (diff) | |
download | couchdb-remsh.tar.gz |
Remsh: attempt to auto-locate Erlang cookieremsh
Attempts to find the Erlang cookie from ERL_FLAGS or the
standard vm.args location. If not present, fall back to the default
(monster).
-rwxr-xr-x | rel/overlay/bin/remsh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/rel/overlay/bin/remsh b/rel/overlay/bin/remsh index 2d28a8c85..2ac421b07 100755 --- a/rel/overlay/bin/remsh +++ b/rel/overlay/bin/remsh @@ -23,8 +23,18 @@ BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin PROGNAME=${0##*/} VERBOSE="" NODE="couchdb@127.0.0.1" -COOKIE=monster LHOST=127.0.0.1 +VM_ARGS=$COUCHDB_BIN_DIR/../etc/vm.args + +# If present, extract cookie from ERL_FLAGS +# This is used by the CouchDB Dockerfile and Helm chart +COOKIE=$(echo "$ERL_FLAGS" | sed 's/^.*setcookie \([^ ][^ ]*\).*$/\1/g') +if test -f "$VM_ARGS"; then +# else attempt to extract from vm.args + VM_ARGS_COOKIE=$(awk '$1=="-setcookie"{print $2}' "$VM_ARGS") + COOKIE="${COOKIE:-$VM_ARGS_COOKIE}" +fi +COOKIE="${COOKIE:-monster}" printHelpAndExit() { echo "Usage: ${PROGNAME} [OPTION]... [-- <additional Erlang cli options>]" |