flask-caching
flask-caching copied to clipboard
No configuration options when using redis url
https://github.com/pallets-eco/flask-caching/blob/348dbecf1365128799f99cb4d751f212089bb218/src/flask_caching/backends/rediscache.py#L98
The cache options aren't passed to the factory for URL defined connections.
This can be a pain when you use Heroku for example, where you are provided a URL and have to disable cert verification for SSL clients: https://help.heroku.com/HC0F8CUS/redis-connection-issues
Luckily, after a bit of researching I found out that you can pass (at least the ssl) kwargs via the url as well. The following snippet adds this to the query string while ensuring that the config doesn't break when heroku decides to add a query string themselves (currently the redis url of heroku doesn't have one):
'CACHE_REDIS_URL': os.getenv("REDIS_TLS_URL") + ("&" if "?" in os.getenv("REDIS_TLS_URL") else "?") + "ssl_cert_reqs=none"