From dc0ee2c7064c625a015d2828c4854926f8078fb7 Mon Sep 17 00:00:00 2001 From: Nicolas Battaglini <43277447+Tireur2cables@users.noreply.github.com> Date: Sun, 9 Aug 2026 14:22:18 +0200 Subject: [PATCH 1/2] Add support for REDIS_HOST_DB environment variable add support for REDIS_HOST_DB env in the default redis config file Signed-off-by: Nicolas Battaglini <43277447+Tireur2cables@users.noreply.github.com> --- .config/redis.config.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.config/redis.config.php b/.config/redis.config.php index 2069812f4..116e7f482 100644 --- a/.config/redis.config.php +++ b/.config/redis.config.php @@ -18,4 +18,8 @@ if (getenv('REDIS_HOST_USER') !== false) { $CONFIG['redis']['user'] = (string) getenv('REDIS_HOST_USER'); } + + if (getenv('REDIS_HOST_DB') !== false) { + $CONFIG['redis']['dbindex'] = (int) getenv('REDIS_HOST_DB'); + } } From f123af3b717a7cb4d35f3687c8c09d2a70f06f21 Mon Sep 17 00:00:00 2001 From: Nicolas Battaglini <43277447+Tireur2cables@users.noreply.github.com> Date: Sun, 9 Aug 2026 14:47:03 +0200 Subject: [PATCH 2/2] Feat: use REDIS_HOST_DB in docker-entrypoint --- README.md | 1 + docker-entrypoint.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eef0ff67c..10a7a8280 100644 --- a/README.md +++ b/README.md @@ -289,6 +289,7 @@ To use Redis for memory caching as well as PHP session storage, specify the foll - `REDIS_HOST_PORT` (default: `6379`) Optional port for Redis, only use for external Redis servers that run on non-standard ports. - `REDIS_HOST_USER` (not set by default) Optional username for Redis, only use for external Redis servers that require a user. - `REDIS_HOST_PASSWORD` (not set by default) Redis password +- `REDIS_HOST_DB` (default: `0`) Index of the Redis database to use, set dbindex parameter in the redis config file for Nextcloud. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html) for more information. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index d8d21c1f6..bec56a705 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -104,10 +104,10 @@ configure_redis_session() { case "$REDIS_HOST" in /*) - redis_save_path="unix://${REDIS_HOST}" + redis_save_path="unix://${REDIS_HOST}/${REDIS_HOST_DB:=0}" ;; *) - redis_save_path="tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}" + redis_save_path="tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}/${REDIS_HOST_DB:=0}" ;; esac