Adding support for DBINDEX redis config value - #2594
Conversation
add support for REDIS_HOST_DB env in the default redis config file Signed-off-by: Nicolas Battaglini <43277447+Tireur2cables@users.noreply.github.com>
There was a problem hiding this comment.
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_DBenvironment variable inREADME.md. - Add
REDIS_HOST_DBhandling for PHP session Redis configuration indocker-entrypoint.sh. - Add
REDIS_HOST_DB->$CONFIG['redis']['dbindex']mapping in.config/redis.config.phpfor 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.
| 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}" | ||
| ;; |
There was a problem hiding this comment.
I think that this is fake but I may misunderstand how this path is used. Redis url template uses /dbindex and not ?database=
| 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}" |
| - `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. |
There was a problem hiding this comment.
I do not think that the session storage part is relevant for any user
|
I am not sure what is wrong with my commit signature also, in my repository I see both commits as |
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