Skip to content

Commit

Permalink
Second cookie fix: accept any ERLX_OVERRIDE_COOKIE environment variab…
Browse files Browse the repository at this point in the history
…le as a top level cookie source.
  • Loading branch information
Olivier-Boudeville committed Aug 11, 2020
1 parent 731bd1c commit d1bca5e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions priv/templates/extended_bin
Original file line number Diff line number Diff line change
Expand Up @@ -647,17 +647,21 @@ fi

# Extract the target cookie
# Do this before relx_get_nodename so we can use it and not create a ~/.erlang.cookie
COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH" || true)"
DEFAULT_COOKIE_FILE="$HOME/.erlang.cookie"
if [ -z "$COOKIE_ARG" ]; then
if [ -f "$DEFAULT_COOKIE_FILE" ]; then
COOKIE="$(cat "$DEFAULT_COOKIE_FILE")"
if [ -n "$ERLX_OVERRIDE_COOKIE" ]; then
COOKIE="$ERLX_OVERRIDE_COOKIE"
else
COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH" || true)"
DEFAULT_COOKIE_FILE="$HOME/.erlang.cookie"
if [ -z "$COOKIE_ARG" ]; then
if [ -f "$DEFAULT_COOKIE_FILE" ]; then
COOKIE="$(cat "$DEFAULT_COOKIE_FILE")"
else
echo "No cookie is set or found. This limits the scripts functionality, installing, upgrading, rpc and getting a list of versions will not work."
fi
else
echo "No cookie is set or found. This limits the scripts functionality, installing, upgrading, rpc and getting a list of versions will not work."
# Extract cookie name from COOKIE_ARG
COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')"
fi
else
# Extract cookie name from COOKIE_ARG
COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')"
fi

# User can specify an sname without @hostname
Expand Down

0 comments on commit d1bca5e

Please sign in to comment.