netbox-community / netbox-docker

🐳 Docker Image of NetBox
https://github.com/netbox-community/netbox-docker/wiki
Apache License 2.0
1.81k stars 828 forks source link

Add Redis Sentinel config as environment vars #1134

Closed NeodymiumFerBore closed 8 months ago

NeodymiumFerBore commented 8 months ago

Related Issue: None

New Behavior

Allow to configure Redis Sentinel via environment variables. This change does not break existing configurations.

Contrast to Current Behavior

Cannot configure Redis Sentinels without using extra config mechanism.

Discussion: Benefits and Drawbacks

If environment variable REDIS_SENTINELS or REDIS_CACHE_SENTINELS are not defined, the resulting configuration will be an empty list []. Upstream netbox also defaults it to [] (redis tasks, redis cache).

I chose to not default REDIS["cache"]["SENTINELS"] to redis tasks Sentinels (as it is done for HOST and PORT for example), because SENTINELS always takes precedence over direct connection. And one may want to use Sentinels for a redis instance but not the other one.

Benefits:

Changes to the Wiki

I don't think any

Proposed Release Note Entry

Allow to configure Redis Sentinels via environment variables

Double Check

NeodymiumFerBore commented 8 months ago

Just realized PR #1130 was already opened for this topic, but as draft. Since this one has less code duplication, I keep it open.