fix(bin/emqx): fail fast if cookie is obviously wrong
This commit is contained in:
parent
4cc92c0368
commit
8d480a1dc9
10
bin/emqx
10
bin/emqx
|
@ -545,6 +545,10 @@ else
|
|||
logerr "Make sure environment variable EMQX_NODE__NAME is set to indicate for which node this command is intended."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [ -n "${EMQX_NODE__NAME:-}" ]; then
|
||||
die "Node $EMQX_NODE__NAME is not running?"
|
||||
fi
|
||||
fi
|
||||
## We have no choiece but to read the bootstrap config (with environment overrides available in the current shell)
|
||||
[ -f "$EMQX_ETC_DIR"/emqx.conf ] || die "emqx.conf is not found in $EMQX_ETC_DIR" 1
|
||||
|
@ -940,9 +944,11 @@ if [ -n "${EMQX_NODE_COOKIE:-}" ]; then
|
|||
unset EMQX_NODE_COOKIE
|
||||
fi
|
||||
COOKIE="${EMQX_NODE__COOKIE:-}"
|
||||
if [ -z "$COOKIE" ]; then
|
||||
COOKIE="$(get_boot_config 'node.cookie')"
|
||||
COOKIE_IN_USE="$(get_boot_config 'node.cookie')"
|
||||
if [ -n "$COOKIE_IN_USE" ] && [ -n "$COOKIE" ] && [ "$COOKIE" != "$COOKIE_IN_USE" ]; then
|
||||
die "EMQX_NODE__COOKIE is different from the cookie used by $NAME"
|
||||
fi
|
||||
[ -z "$COOKIE" ] && COOKIE="$COOKIE_IN_USE"
|
||||
[ -z "$COOKIE" ] && COOKIE="$EMQX_DEFAULT_ERLANG_COOKIE"
|
||||
|
||||
maybe_warn_default_cookie() {
|
||||
|
|
Loading…
Reference in New Issue