-
Notifications
You must be signed in to change notification settings - Fork 298
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
fix: align ee settings to include huey #1448
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -113,6 +113,7 @@ def set_ciso_assistant_url(_, __, event_dict): | |||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
# SECURITY WARNING: don't run with debug turned on in production! | ||||||||||||||||||||||||||||||||||||||||||||||
DEBUG = os.environ.get("DJANGO_DEBUG", "False") == "True" | ||||||||||||||||||||||||||||||||||||||||||||||
MAIL_DEBUG = os.environ.get("MAIL_DEBUG", "False") == "True" | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
logger.info("DEBUG mode: %s", DEBUG) | ||||||||||||||||||||||||||||||||||||||||||||||
logger.info("CISO_ASSISTANT_URL: %s", CISO_ASSISTANT_URL) | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -157,6 +158,7 @@ def set_ciso_assistant_url(_, __, event_dict): | |||||||||||||||||||||||||||||||||||||||||||||
"allauth.socialaccount", | ||||||||||||||||||||||||||||||||||||||||||||||
"allauth.socialaccount.providers.saml", | ||||||||||||||||||||||||||||||||||||||||||||||
"allauth.mfa", | ||||||||||||||||||||||||||||||||||||||||||||||
"huey.contrib.djhuey", | ||||||||||||||||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
MIDDLEWARE = [ | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -308,9 +310,16 @@ def set_ciso_assistant_url(_, __, event_dict): | |||||||||||||||||||||||||||||||||||||||||||||
("es", "Spanish"), | ||||||||||||||||||||||||||||||||||||||||||||||
("de", "German"), | ||||||||||||||||||||||||||||||||||||||||||||||
("it", "Italian"), | ||||||||||||||||||||||||||||||||||||||||||||||
("nd", "Dutch"), | ||||||||||||||||||||||||||||||||||||||||||||||
("nl", "Dutch"), | ||||||||||||||||||||||||||||||||||||||||||||||
("pl", "Polish"), | ||||||||||||||||||||||||||||||||||||||||||||||
("pt", "Portuguese"), | ||||||||||||||||||||||||||||||||||||||||||||||
("ar", "Arabic"), | ||||||||||||||||||||||||||||||||||||||||||||||
("ro", "Romanian"), | ||||||||||||||||||||||||||||||||||||||||||||||
("hi", "Hindi"), | ||||||||||||||||||||||||||||||||||||||||||||||
("ur", "Urdu"), | ||||||||||||||||||||||||||||||||||||||||||||||
("cs", "Czech"), | ||||||||||||||||||||||||||||||||||||||||||||||
("sv", "Swedish"), | ||||||||||||||||||||||||||||||||||||||||||||||
("id", "Indonesian"), | ||||||||||||||||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -339,6 +348,7 @@ def set_ciso_assistant_url(_, __, event_dict): | |||||||||||||||||||||||||||||||||||||||||||||
"PASSWORD": os.environ["POSTGRES_PASSWORD"], | ||||||||||||||||||||||||||||||||||||||||||||||
"HOST": os.environ["DB_HOST"], | ||||||||||||||||||||||||||||||||||||||||||||||
"PORT": os.environ.get("DB_PORT", "5432"), | ||||||||||||||||||||||||||||||||||||||||||||||
"CONN_MAX_AGE": os.environ.get("CONN_MAX_AGE", 300), | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -427,3 +437,19 @@ def set_ciso_assistant_url(_, __, event_dict): | |||||||||||||||||||||||||||||||||||||||||||||
logger.info("License information", seats=LICENSE_SEATS, expiration=LICENSE_EXPIRATION) | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
INSTALLED_APPS.append("enterprise_core") | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
if MAIL_DEBUG: | ||||||||||||||||||||||||||||||||||||||||||||||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" | ||||||||||||||||||||||||||||||||||||||||||||||
DEFAULT_FROM_EMAIL = "[email protected]" | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
## Huey settings | ||||||||||||||||||||||||||||||||||||||||||||||
HUEY_FILE_PATH = os.environ.get("HUEY_FILE_PATH", BASE_DIR / "db" / "huey.db") | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
HUEY = { | ||||||||||||||||||||||||||||||||||||||||||||||
"huey_class": "huey.SqliteHuey", | ||||||||||||||||||||||||||||||||||||||||||||||
"name": "ciso_assistant", | ||||||||||||||||||||||||||||||||||||||||||||||
"filename": HUEY_FILE_PATH, | ||||||||||||||||||||||||||||||||||||||||||||||
"results": True, # would be interesting for debug | ||||||||||||||||||||||||||||||||||||||||||||||
"immediate": False, # set to False to run in "live" mode regardless of DEBUG, otherwise it will follow | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+446
to
+455
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance Huey configuration robustness. Several improvements needed for the Huey configuration:
## Huey settings
HUEY_FILE_PATH = os.environ.get("HUEY_FILE_PATH", BASE_DIR / "db" / "huey.db")
+# Ensure directory exists
+os.makedirs(os.path.dirname(HUEY_FILE_PATH), exist_ok=True)
HUEY = {
"huey_class": "huey.SqliteHuey",
"name": "ciso_assistant",
"filename": HUEY_FILE_PATH,
"results": True, # would be interesting for debug
- "immediate": False, # set to False to run in "live" mode regardless of DEBUG, otherwise it will follow
+ "immediate": False, # Set to False to run in "live" mode regardless of DEBUG setting
} 📝 Committable suggestion
Suggested change
|
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.
🛠️ Refactor suggestion
Convert CONN_MAX_AGE to integer and document load balancer considerations.
The CONN_MAX_AGE should be converted to an integer, and we should document potential issues with load balancers.
Consider documenting that if you're using a load balancer, CONN_MAX_AGE should be less than the load balancer's connection timeout to prevent connection reset issues.
📝 Committable suggestion