Skip to content

Adding support for DBINDEX redis config value - #2594

Open
Tireur2cables wants to merge 2 commits into
nextcloud:masterfrom
Tireur2cables:patch-1
Open

Adding support for DBINDEX redis config value#2594
Tireur2cables wants to merge 2 commits into
nextcloud:masterfrom
Tireur2cables:patch-1

Conversation

@Tireur2cables

Copy link
Copy Markdown

As discussed in #2288 , #2236 and #1286 It would be usefull to add the possibility to set dbindex parameter if needed.
Even if it is not the most usefull parameter of redis, it is still supported by redis and users may want to use it.
The default value of dbindex that is already used silently is 0.
I suggest to add this possibilty while keeping the default at 0 in order to prevent current users from any changes and let the possibility to those who want it to customize this parameter via an environment variable.

As the #2288 is a little old I will propose a new PR.

Closes #2593

add support for REDIS_HOST_DB env in the default redis config file

Signed-off-by: Nicolas Battaglini <43277447+Tireur2cables@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 9, 2026 13:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for configuring the Redis database index (“dbindex”) via environment variable, so deployments can share a Redis instance across multiple apps while keeping the default behavior (DB 0) unchanged.

Changes:

  • Document new REDIS_HOST_DB environment variable in README.md.
  • Add REDIS_HOST_DB handling for PHP session Redis configuration in docker-entrypoint.sh.
  • Add REDIS_HOST_DB -> $CONFIG['redis']['dbindex'] mapping in .config/redis.config.php for Nextcloud’s Redis config.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
README.md Documents the new REDIS_HOST_DB environment variable.
docker-entrypoint.sh Updates PHP session Redis session.save_path construction to incorporate a DB index.
.config/redis.config.php Adds Nextcloud Redis config support for dbindex via REDIS_HOST_DB.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docker-entrypoint.sh
Comment on lines +107 to 111
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}"
;;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is fake but I may misunderstand how this path is used. Redis url template uses /dbindex and not ?database=

Comment thread docker-entrypoint.sh
Comment on lines +107 to +110
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}"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is intended I think

Comment thread README.md
- `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.

@Tireur2cables Tireur2cables Aug 9, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that the session storage part is relevant for any user

@Tireur2cables

Copy link
Copy Markdown
Author

I am not sure what is wrong with my commit signature also, in my repository I see both commits as verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding support for DBINDEX redis config value

2 participants