-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent certain configuration settings from unexpectedly reverting to defaults #3862
Conversation
Add workaround for constance to not reset values to default when unable to connect to a database object.
kobo/settings/base.py
Outdated
@@ -844,6 +845,11 @@ def __init__(self, *args, **kwargs): | |||
'socket_timeout': env.int('REDIS_SESSION_SOCKET_TIMEOUT', 1), | |||
} | |||
|
|||
CACHES = { | |||
# Set CACHE_URL to override | |||
'default': env.cache(default=env.str("REDIS_SESSION_URL", default='redis://redis_cache:6380/2')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather use another variable name REDIS_CONSTANCE_BACKEND_URL
(in single-quote :P). I know it's another one, but I would leave the session database alone and use a different index.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. That means adding to kobo-install right? I suppose kobo-install doesn't need to ask anything extra, but needs to set this new env var.
For future local dev environments, it could use the passwordless default redis_cache with a different index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly kobotoolbox/kobo-install#193
LGTM, tests are passing locally. |
Description
Work around django-constance issue where values are undesirably reset to their default.
Add redis cache for constance database backend.
Introduces a new environment variable
CACHE_URL
to define the default Django cache. This is only used for constance right now, but could be used elsewhere.Internal notes
This requires updating kobo-install. Do not release this change until kobo-install is updated to support CACHE_URL with the existing redis instance.