Skip to content

Commit

Permalink
fix bug with env-vars
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Ubuntu authored and Ubuntu committed Sep 19, 2020
1 parent fb50f74 commit fa13a99
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions 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"}
Expand All @@ -34,4 +20,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 "$@"

0 comments on commit fa13a99

Please sign in to comment.