Closed martinpeck closed 6 years ago
@martinpeck would it work for you to just use the configuration options CACHE_REDIS_HOST, CACHE_REDIS_PASSWORD, CACHE_REDIS_PORT and CACHE_REDIS_DB instead of CACHE_REDIS_URL?
Those are options for sure, but do any of these then force use of SSL? I know you can set the CACHE_REDIS_PORT, but does this then set the connection to use SSL?
that said....I still think it would make sense to allow Flask-Cache to pass through something to the underlying redis-py
to say "my url is urlencoded"
I wonder if CACHE_REDIS_URL and CACHE_REDIS_PASSWORD can work in combination... (redis-py noob)
Having scanned through the code of Flask-Cache and Redis-Py, I'm not sure that'll work. I'll take another look, but pretty sure I looked for this.
This hasn't got traction, and the related issue has been resolved, so I'm going to close this now.
If I try and use a REDIS_CACHE_URL, and within that url I have a password that looks like this...
... (notice that it has two
/
characters) then I see a connection error as the url is not parsed correctly.The underlying package
redis-py
supports URLEncoding/Decoding of connection urls, but it's something that requires code changes (it requires an additional parameter when making the connection). e.g...To make use of this ability, this code would need to be alterered to use this
decode_components
parameter:https://github.com/thadeusb/flask-cache/blob/1c60076b6d4c2df0ac1de54c59e63b4f780cecbc/flask_cache/backends.py#L79-L81
Is it reasonable that
flash-cache
should make a change so that it usesdecode_components = True
in all situations or, to preserve the current behaviour, is is reasonable to add an additional ENV variable (e.g.CACHE_REDIS_ENCODED_URL
to specify an encoded URL, orCACHE_REDIS_DECODE_URL
set toTrue
if decoding should occur)? If so, I'm happy to provide a PR.