Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

checks: Extract helper for settings location and display name.

Lauryn Menard4782e1577b4b
diff --git a/zerver/checks.py b/zerver/checks.py
index b6ff3a78cda..f069460a713 100644
--- a/zerver/checks.py
+++ b/zerver/checks.py
@@ -8,6 +8,22 @@ from django.conf import settings
from django.core import checks
+def get_settings_error_message_strings(setting_name: str) -> tuple[str, str]:
+ # Even in Docker, MANUAL_CONFIGURATION means the admin
+ # manages /etc/zulip/settings.py themselves, so the SETTING_*
+ # environment variables are not where to make changes.
+ if settings.RUNNING_IN_HELM:
+ settings_location = "your Helm values"
+ setting_display_name = "zulip.environment.SETTING_" + setting_name
+ elif settings.RUNNING_IN_DOCKER and os.environ.get("MANUAL_CONFIGURATION") != "True":
+ settings_location = "your Docker environment configuration"
+ setting_display_name = "SETTING_" + setting_name
+ else:
+ settings_location = "/etc/zulip/settings.py"
+ setting_display_name = setting_name
+ return settings_location, setting_display_name
+
+
def check_required_settings(
app_configs: Sequence[AppConfig] | None,
databases: Sequence[str] | None,
@@ -31,18 +47,7 @@ def check_required_settings(
if value and value != default:
continue
- # Even in Docker, MANUAL_CONFIGURATION means the admin
- # manages /etc/zulip/settings.py themselves, so the SETTING_*
- # environment variables are not where to make changes.
- if settings.RUNNING_IN_HELM:
- settings_location = "your Helm values"
- setting_display_name = "zulip.environment.SETTING_" + setting_name
- elif settings.RUNNING_IN_DOCKER and os.environ.get("MANUAL_CONFIGURATION") != "True":
- settings_location = "your Docker environment configuration"
- setting_display_name = "SETTING_" + setting_name
- else:
- settings_location = "/etc/zulip/settings.py"
- setting_display_name = setting_name
+ settings_location, setting_display_name = get_settings_error_message_strings(setting_name)
if value:
# The setting is still the example value from the
# documentation, which the admin must replace -- saying