nextcloud&notify-push: allow to adjust the DATABASE_TYPE

Signed-off-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
Simon L. 2024-10-18 17:50:31 +02:00
parent 9bf38d2795
commit 4be6d492ea
3 changed files with 23 additions and 6 deletions

View file

@ -1,13 +1,13 @@
#!/bin/bash
if [ -z "$NEXTCLOUD_HOST" ]; then
echo "NEXTCLOUD_HOST need to be provided. Exiting!"
echo "NEXTCLOUD_HOST needs to be provided. Exiting!"
exit 1
elif [ -z "$POSTGRES_HOST" ]; then
echo "POSTGRES_HOST need to be provided. Exiting!"
echo "POSTGRES_HOST needs to be provided. Exiting!"
exit 1
elif [ -z "$REDIS_HOST" ]; then
echo "REDIS_HOST need to be provided. Exiting!"
echo "REDIS_HOST needs to be provided. Exiting!"
exit 1
fi
@ -52,9 +52,16 @@ fi
if [ -z "$REDIS_DB_INDEX" ]; then
REDIS_DB_INDEX=0
fi
# Set a default for db type
if [ -z "$DATABASE_TYPE" ]; then
DATABASE_TYPE=postgres
elif [ "$DATABASE_TYPE" != postgres ] && [ "$DATABASE_TYPE" != mysql ]; then
echo "DB type must be either postgres or mysql"
exit 1
fi
# Set sensitive values as env
export DATABASE_URL="postgres://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB"
export DATABASE_URL="$DATABASE_TYPE://oc_$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB"
export REDIS_URL="redis://:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX"
# Run it