Added ZULIP_AUTHENTICATION_BACKENDS_* vars

Changed [ -f ...] to [ -e ...]
This commit is contained in:
Alexander Trost
2015-10-18 13:43:05 +02:00
parent 7a083d7ce2
commit 8b21395b9b
3 changed files with 21 additions and 3 deletions

View File

@@ -42,5 +42,6 @@ RUN apt-get -qq update -q && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
VOLUME ["$DATA_DIR"] VOLUME ["$DATA_DIR"]
EXPOSE 80 443
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -41,6 +41,7 @@ zulip:
REDIS_HOST: "redis" REDIS_HOST: "redis"
RABBITMQ_HOST: "rabbitmq" RABBITMQ_HOST: "rabbitmq"
ZULIP_USER_EMAIL: "example@example.com" ZULIP_USER_EMAIL: "example@example.com"
ZULIP_AUTHENTICATION_BACKENDS_EmailAuthBackend: "EmailAuthBackend"
ZULIP_SECRETS_email_password: "12345" ZULIP_SECRETS_email_password: "12345"
ZULIP_SECRETS_rabbitmq_password: "zulip" ZULIP_SECRETS_rabbitmq_password: "zulip"
ZULIP_SETTINGS_EXTERNAL_HOST: "localhost" ZULIP_SETTINGS_EXTERNAL_HOST: "localhost"

View File

@@ -157,6 +157,22 @@ CACHES = {
}, },
} }
EOF EOF
# Remove the part from the auth backends settings
echo "AUTHENTICATION_BACKENDS = (" >> "$ZULIP_ZPROJECT_SETTINGS"
local POSSIBLE_AUTH_BACKENDS=(
"EmailAuthBackend" "ZulipRemoteUserBackend" "GoogleMobileOauth2Backend" "ZulipLDAPAuthBackend"
)
for AUTH_BACKEND_KEY in "${POSSIBLE_AUTH_BACKENDS[@]}"; do
local KEY="ZULIP_AUTHENTICATION_BACKENDS_$AUTH_BACKEND_KEY"
local AUTH_BACKEND_VAR="${!KEY}"
if [ -z "$AUTH_BACKEND_VAR" ]; then
echo "No authentication backend for key \"$AUTH_BACKEND_KEY\"."
continue
fi
echo "Adding authentication backend \"$AUTH_BACKEND_KEY\"."
echo "'zproject.backends.$AUTH_BACKEND_VAR'," >> "$ZULIP_ZPROJECT_SETTINGS"
done
echo ")" >> "$ZULIP_ZPROJECT_SETTINGS"
# Rabbitmq settings # Rabbitmq settings
sed -i "s~pika.ConnectionParameters('localhost',~pika.ConnectionParameters(settings.RABBITMQ_HOST,~g" "$ZULIP_CURRENT_DEPLOY/zerver/lib/queue.py" sed -i "s~pika.ConnectionParameters('localhost',~pika.ConnectionParameters(settings.RABBITMQ_HOST,~g" "$ZULIP_CURRENT_DEPLOY/zerver/lib/queue.py"
cat >> "$ZULIP_ZPROJECT_SETTINGS" <<EOF cat >> "$ZULIP_ZPROJECT_SETTINGS" <<EOF
@@ -257,7 +273,7 @@ fi
ln -sfT "$DATA_DIR/uploads" "$ZULIP_DIR/uploads" ln -sfT "$DATA_DIR/uploads" "$ZULIP_DIR/uploads"
# Configure rabbitmq server everytime because it could be a new one ;) # Configure rabbitmq server everytime because it could be a new one ;)
rabbitmqSetup rabbitmqSetup
if [ ! -f "$DATA_DIR/.initiated" ]; then if [ ! -e "$DATA_DIR/.initiated" ]; then
echo "Initiating Zulip initiation ..." echo "Initiating Zulip initiation ..."
echo "===" echo "==="
echo "Generating and setting secrets ..." echo "Generating and setting secrets ..."
@@ -288,10 +304,10 @@ if [ ! -f "$DATA_DIR/.initiated" ]; then
echo "Created zulip user account" echo "Created zulip user account"
echo "===" echo "==="
echo "Zulip initiation done." echo "Zulip initiation done."
touch "$DATA_DIR/.initiated" touch "$DATA_DIR/. "
fi fi
# If there's an "update" available, then JUST DO IT! # If there's an "update" available, then JUST DO IT!
if [ ! -f "$DATA_DIR/.zulip-$ZULIP_VERSION" ]; then if [ ! -e "$DATA_DIR/.zulip-$ZULIP_VERSION" ]; then
echo "Starting zulip migration ..." echo "Starting zulip migration ..."
if ! "$MANAGE_PY" migrate; then if ! "$MANAGE_PY" migrate; then
echo "Zulip migration error." echo "Zulip migration error."