feat: Make redis database configurable for cache.

Use the same redis database as openedx cache by default.
This commit is contained in:
liupengcheng 2021-05-18 11:01:59 +08:00 committed by Régis Behmo
parent a36718277e
commit aa65ddf9d3
2 changed files with 2 additions and 1 deletions

View File

@ -25,6 +25,7 @@ config = {
"OAUTH2_KEY_DEV": "discovery-dev",
"OAUTH2_KEY_SSO": "discovery-sso",
"OAUTH2_KEY_SSO_DEV": "discovery-sso-dev",
"CACHE_REDIS_DB": "{{ OPENEDX_CACHE_REDIS_DB }}",
},
}

View File

@ -31,7 +31,7 @@ CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"KEY_PREFIX": "discovery",
"LOCATION": "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/1",
"LOCATION": "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ DISCOVERY_CACHE_REDIS_DB }}",
}
}