Skip to content
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

feat(cache): redis cache implementation #301

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ services:
- .env
- wiki/.env.base

redis:
image: redis:latest
container_name: fiesta-redis
ports:
- "6379:6379"

volumes:
postgres15_data:
legacydb_data:
Expand Down
32 changes: 28 additions & 4 deletions fiesta/fiesta/settings/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,36 @@ def DEFAULT_FROM_EMAIL(self):
ENVIRONMENT_NAME: str = Value(environ_required=False)
ENVIRONMENT_COLOR: str = Value(environ_required=False)
RELEASE_NAME: str = Value(environ_required=False, default="fiesta-plus@dev")

CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.db.DatabaseCache",
"LOCATION": "django_cache",
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': 'redis://fiesta-redis:6379/1',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
}
}
}

SESSION_ENGINE = "django.contrib.sessions.backends.cache"
SESSION_CACHE_ALIAS = "default"


LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django_redis': {
'handlers': ['console'],
'level': 'DEBUG',
},
},
}
Comment on lines +164 to +179
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjust logging level to prevent sensitive information exposure

Currently, the logging configuration sets the 'django_redis' logger to 'DEBUG' level, which may expose sensitive information in production environments. It's recommended to adjust the logging level to 'INFO' or higher in production to avoid potential information leakage.

Consider updating the logging level:

     'handlers': {
         'console': {
-            'level': 'DEBUG',
+            'level': 'INFO',
             'class': 'logging.StreamHandler',
         },
     },
     'loggers': {
         'django_redis': {
             'handlers': ['console'],
-            'level': 'DEBUG',
+            'level': 'INFO',
         },
     },
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django_redis': {
'handlers': ['console'],
'level': 'DEBUG',
},
},
}
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django_redis': {
'handlers': ['console'],
'level': 'INFO',
},
},
}


SELECT2_CACHE_BACKEND = "default"
Loading
Loading