Merge pull request #5374 from zmstone/chore-delete-emqx-name-and-emqx-host-env-var

chore: delete EMQX_NAME and EMQX_HOST env variables
This commit is contained in:
Zaiming (Stone) Shi 2021-08-03 17:08:50 +02:00 committed by GitHub
commit 3d0cb11682
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 25 deletions

View File

@ -316,12 +316,9 @@ esac
## Possible ways to configure emqx node name:
## 1. configure node.name in emqx.conf
## 2. override with environment variable EMQX_NODE_NAME
## 3. override with environment variable EMQX_NAME and EMQX_HOST (deprecated)
## Node name is either short-name (without '@'), e.g. 'emqx'
## or long name (with '@') e.g. 'emqx@example.net' or 'emqx@127.0.0.1'
NAME="${EMQX_NODE_NAME:-}"
# to be backward compatible
[ -n "$EMQX_NAME" ] && [ -n "$EMQX_HOST" ] && NAME="${EMQX_NAME}@${EMQX_HOST}"
if [ -z "$NAME" ]; then
if [ "$IS_BOOT_COMMAND" = 'no' ]; then
# for non-boot commands, inspect vm.<time>.args for node name

View File

@ -16,16 +16,13 @@ shopt -s nullglob
LOCAL_IP=$(hostname -i | grep -oE '((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])\.){3}(25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])' | head -n 1)
## EMQ Base settings and plugins setting
# Base settings in /opt/emqx/etc/emqx.conf
# Plugin settings in /opt/emqx/etc/plugins
if [[ -z "$EMQX_NODE_NAME" ]]; then
if [[ -z "$EMQX_NAME" ]]; then
if [[ -z "$EMQX_NAME" ]]; then
EMQX_NAME="$(hostname)"
export EMQX_NAME
fi
fi
if [[ -z "$EMQX_HOST" ]]; then
if [[ -z "$EMQX_HOST" ]]; then
if [[ "$EMQX_CLUSTER__K8S__ADDRESS_TYPE" == "dns" ]] && [[ -n "$EMQX_CLUSTER__K8S__NAMESPACE" ]]; then
EMQX_CLUSTER__K8S__SUFFIX=${EMQX_CLUSTER__K8S__SUFFIX:-"pod.cluster.local"}
EMQX_HOST="${LOCAL_IP//./-}.$EMQX_CLUSTER__K8S__NAMESPACE.$EMQX_CLUSTER__K8S__SUFFIX"
@ -35,11 +32,10 @@ if [[ -z "$EMQX_HOST" ]]; then
else
EMQX_HOST="$LOCAL_IP"
fi
export EMQX_HOST
fi
if [[ -z "$EMQX_NODE_NAME" ]]; then
fi
export EMQX_NODE_NAME="$EMQX_NAME@$EMQX_HOST"
unset EMQX_NAME
unset EMQX_HOST
fi
# fill tuples on specific file