How to set password for connection with redis?
Is there any such option in the channel? As this password is specified in the config file?
Now I use this config:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"ROUTING": "widget.routing.channel_routing",
"CONFIG": {
"hosts": [("127.0.0.1", 6379)],
},
},
}
No, the backend does not support Redis passwords; I'll add it to the list of features to get in there, though encryption support is probably higher-priority as Redis passwords are really not secure.
It seems to me you do not know all the possibilities of your product. I used here is just these settings:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"ROUTING": "widget.routing.channel_routing",
"CONFIG": {
"hosts": [("redis://:[email protected]:6379/0")],
},
},
}
and it worked. Close this issue now.
P.S.: Add this info into your documentation. It may be useful for somebody.
Ah, fair enough, I didn't realise the redis backend string did that.
Does this issue fixed now??? I can't find the way to set redis password from document.
Just follow the example above and set it in the connection string.
This commit resolves the issue: Add redis's password from config to txredisapi. (#41)
Thank you so much @onegreyonewhite !
Hey thanks for it save me alot alot of headache. Thanks.🙏🙏🙏
Thank you very much, I've been trying to solve this issue for a couple of days with no luck.
Thanks a lot, it worked @onegreyonewhite. But can anyone help me with the reason, why it works?
Thanks a lot, it worked @onegreyonewhite. But can anyone help me with the reason, why it works?
This works because ConnectionPool supports url scheme.
Notice that python ignores parentheses when wrapping single element, so
"hosts": [("redis://:[email protected]:6379/0")],
euqals
"hosts": ["redis://:[email protected]:6379/0"],
however, leving a comma at the end makes it a tuple, and acceable tuple format should be (host, port), so code below will cause error
"hosts": [("redis://:[email protected]:6379/0", )],