From 9645f521f86f15002eb46e282f2265d2ab4d5417 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sat, 19 Sep 2020 23:30:12 +0000 Subject: [PATCH] fix bug with env-vars env-vars should be defined before the if conditional branches, so that in case they execute, there will be no errors about undefined env-vars --- docker-entrypoint.sh | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 9569365..fe02b5c 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,20 +1,6 @@ #!/bin/bash set -e -if [[ "$1" != "prosody" ]]; then - exec prosodyctl $* - exit 0; -fi - -if [ "$LOCAL" -a "$PASSWORD" -a "$DOMAIN" ] ; then - prosodyctl register $LOCAL $DOMAIN $PASSWORD -fi - -if [ -z "$DOMAIN" ]; then - echo "[ERROR] DOMAIN must be set!" - exit 1 -fi - export ALLOW_REGISTRATION=${ALLOW_REGISTRATION:-true} export DOMAIN_HTTP_UPLOAD=${DOMAIN_HTTP_UPLOAD:-"upload.$DOMAIN"} export DOMAIN_MUC=${DOMAIN_MUC:-"conference.$DOMAIN"} @@ -35,4 +21,19 @@ export SERVER_CONTACT_INFO_SECURITY=${SERVER_CONTACT_INFO_SECURITY:-"xmpp:securi export SERVER_CONTACT_INFO_SUPPORT=${SERVER_CONTACT_INFO_SUPPORT:-"xmpp:support@$DOMAIN"} export PROSODY_ADMINS=${PROSODY_ADMINS:-""} +if [[ "$1" != "prosody" ]]; then + exec prosodyctl $* + exit 0; +fi + +if [ "$LOCAL" -a "$PASSWORD" -a "$DOMAIN" ] ; then + prosodyctl register $LOCAL $DOMAIN $PASSWORD +fi + +if [ -z "$DOMAIN" ]; then + echo "[ERROR] DOMAIN must be set!" + exit 1 +fi + + exec "$@"