Skip to content

Commit 884ac9b

Browse files
committed
notify-push: refactor to use Nextcloud's config.php directly
Signed-off-by: Simon L. <szaimen@e.mail.de>
1 parent 1ed7196 commit 884ac9b

File tree

2 files changed

+3
-61
lines changed

2 files changed

+3
-61
lines changed

Containers/notify-push/start.sh

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
if [ -z "$NEXTCLOUD_HOST" ]; then
44
echo "NEXTCLOUD_HOST needs to be provided. Exiting!"
55
exit 1
6-
elif [ -z "$POSTGRES_HOST" ]; then
7-
echo "POSTGRES_HOST needs to be provided. Exiting!"
8-
exit 1
9-
elif [ -z "$REDIS_HOST" ]; then
10-
echo "REDIS_HOST needs to be provided. Exiting!"
11-
exit 1
126
fi
137

148
# Only start container if nextcloud is accessible
@@ -44,52 +38,9 @@ fi
4438

4539
echo "notify-push was started"
4640

47-
# Set a default value for POSTGRES_PORT
48-
if [ -z "$POSTGRES_PORT" ]; then
49-
POSTGRES_PORT=5432
50-
fi
51-
# Set a default for redis db index
52-
if [ -z "$REDIS_DB_INDEX" ]; then
53-
REDIS_DB_INDEX=0
54-
fi
55-
# Set a default value for REDIS_PORT
56-
if [ -z "$REDIS_PORT" ]; then
57-
REDIS_PORT=6379
58-
fi
59-
# Set a default for db type
60-
if [ -z "$DATABASE_TYPE" ]; then
61-
DATABASE_TYPE=postgres
62-
elif [ "$DATABASE_TYPE" != postgres ] && [ "$DATABASE_TYPE" != mysql ]; then
63-
echo "DB type must be either postgres or mysql"
64-
exit 1
65-
fi
66-
67-
# Use the correct Postgres username
68-
if [ "$POSTGRES_USER" = nextcloud ]; then
69-
POSTGRES_USER="oc_$POSTGRES_USER"
70-
export POSTGRES_USER
71-
fi
72-
73-
# URL-encode passwords
74-
POSTGRES_PASSWORD="$(jq -rn --arg v "$POSTGRES_PASSWORD" '$v|@uri')"
75-
REDIS_HOST_PASSWORD="$(jq -rn --arg v "$REDIS_HOST_PASSWORD" '$v|@uri')"
76-
77-
# Postgres root cert
78-
if [ -f "/nextcloud/data/certificates/POSTGRES" ]; then
79-
CERT_OPTIONS="?sslmode=verify-ca&sslrootcert=/nextcloud/data/certificates/ca-bundle.crt"
80-
# Mysql root cert
81-
elif [ -f "/nextcloud/data/certificates/MYSQL" ]; then
82-
CERT_OPTIONS="?sslmode=verify-ca&ssl-ca=/nextcloud/data/certificates/ca-bundle.crt"
83-
fi
84-
85-
# Set sensitive values as env
86-
export DATABASE_URL="$DATABASE_TYPE://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB$CERT_OPTIONS"
87-
export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST:$REDIS_PORT/$REDIS_DB_INDEX"
88-
8941
# Run it
9042
/nextcloud/custom_apps/notify_push/bin/"$CPU_ARCH"/notify_push \
91-
--database-prefix="oc_" \
92-
--nextcloud-url "https://$NC_DOMAIN" \
93-
--port 7867
43+
--port 7867 \
44+
/nextcloud/config/config.php
9445

9546
exec "$@"

php/containers.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,17 +303,8 @@
303303
}
304304
],
305305
"environment": [
306-
"NC_DOMAIN=%NC_DOMAIN%",
307306
"NEXTCLOUD_HOST=nextcloud-aio-nextcloud",
308-
"TZ=%TIMEZONE%",
309-
"REDIS_HOST=nextcloud-aio-redis",
310-
"REDIS_PORT=6379",
311-
"REDIS_HOST_PASSWORD=%REDIS_PASSWORD%",
312-
"POSTGRES_HOST=nextcloud-aio-database",
313-
"POSTGRES_PORT=5432",
314-
"POSTGRES_PASSWORD=%DATABASE_PASSWORD%",
315-
"POSTGRES_DB=nextcloud_database",
316-
"POSTGRES_USER=nextcloud"
307+
"TZ=%TIMEZONE%"
317308
],
318309
"restart": "unless-stopped",
319310
"read_only": true,

0 commit comments

Comments
 (0)