Skip to content

Commit

Permalink
Allow disabling redis
Browse files Browse the repository at this point in the history
  • Loading branch information
elfjes committed Apr 23, 2024
1 parent 93b6599 commit 52a37b5
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/argus/site/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,22 @@
ASGI_APPLICATION = "argus.ws.asgi.application"

# fmt: off
_REDIS = urlsplit("//" + get_str_env("ARGUS_REDIS_SERVER", "127.0.0.1:6379"))
CHANNEL_LAYERS = {
ARGUS_DISABLE_REDIS = get_bool_env("ARGUS_DISABLE_REDIS", False)
if ARGUS_DISABLE_REDIS:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [(_REDIS.hostname, _REDIS.port or 6379)],
"BACKEND": "channels.layers.InMemoryChannelLayer"
}
}
else:
_REDIS = urlsplit("//" + get_str_env("ARGUS_REDIS_SERVER", "127.0.0.1:6379"))
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [(_REDIS.hostname, _REDIS.port or 6379)],
},
},
},
}
# fmt: on

Expand Down

0 comments on commit 52a37b5

Please sign in to comment.