diff --git a/apps/emqx-init/entrypoint.sh b/apps/emqx-init/entrypoint.sh index 7b64b18..8b1d421 100755 --- a/apps/emqx-init/entrypoint.sh +++ b/apps/emqx-init/entrypoint.sh @@ -10,15 +10,13 @@ : "${INIT_EMQX_TOPIC_ACTION:=all}" : "${INIT_EMQX_TOPIC_PERMISSION:=allow}" : "${INIT_EMQX_TOPIC_ACLS}" -: "${CURL_PARAMS:=-s}" +: "${CURL_PARAMS:=-s -f -N}" INIT_EMQX_BASE_API_URL="http://${INIT_EMQX_ACCESS_KEY}:${INIT_EMQX_SECRET_KEY}@${INIT_EMQX_API_HOST}:${INIT_EMQX_API_PORT}/api/v5" INIT_EMQX_CHECK_API_URL="${INIT_EMQX_BASE_API_URL}/authentication/password_based:built_in_database/status" INIT_EMQX_AUTHN_API_URL="${INIT_EMQX_BASE_API_URL}/authentication/password_based:built_in_database/users" INIT_EMQX_AUTHZ_API_URL="${INIT_EMQX_BASE_API_URL}/authorization/sources/built_in_database/rules/users" -env | sort - # Wait for EMQX wait_for_emqx() { while ! curl ${CURL_PARAMS} "${INIT_EMQX_CHECK_API_URL}" 2> /dev/null; do @@ -30,97 +28,105 @@ wait_for_emqx() { } # Authentication -check_emqx_user() { - # TODO: check_emqx_user - echo "WARNING: check_emqx_user unimplemented!" - return 1 # 0 = found, 1 = not found -} -update_emqx_user() { - # TODO: update_emqx_user - echo "ERROR: update_emqx_user unimplemented!" - exit 1 -} -create_emqx_user() { - curl ${CURL_PARAMS} \ - "${INIT_EMQX_AUTHN_API_URL}" \ - -H 'Content-Type: application/json' \ - -d "$(cat <