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: Give settings.py advice under MANUAL_CONFIGURATION.

Alex Vandiver23824c341b56
diff --git a/zerver/checks.py b/zerver/checks.py
index cc7311b9a1e..b6ff3a78cda 100644
--- a/zerver/checks.py
+++ b/zerver/checks.py
@@ -31,10 +31,13 @@ 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:
+ 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:
diff --git a/zerver/tests/test_checks.py b/zerver/tests/test_checks.py
index b50c9e6771b..4e5035111df 100644
--- a/zerver/tests/test_checks.py
+++ b/zerver/tests/test_checks.py
@@ -85,6 +85,18 @@ class TestChecks(ZulipTestCase):
ZULIP_ADMINISTRATOR=None,
)
+ @override_settings(RUNNING_IN_DOCKER=True)
+ def test_checks_required_setting_docker_manual_configuration(self) -> None:
+ # With MANUAL_CONFIGURATION, the admin manages
+ # /etc/zulip/settings.py themselves, so the bare-metal
+ # message is the accurate one.
+ with mock.patch.dict(os.environ, {"MANUAL_CONFIGURATION": "True"}):
+ self.assert_check_with_error(
+ "(zulip.E001) ZULIP_ADMINISTRATOR is still set to the example value "
+ "'[email protected]'; change it in /etc/zulip/settings.py",
+ ZULIP_ADMINISTRATOR="[email protected]",
+ )
+
@override_settings(DEVELOPMENT=False, PRODUCTION=True, EXTERNAL_URI_SCHEME="https://")
def test_checks_external_host_domain(self) -> None:
message_re = r"\(zulip\.E002\) EXTERNAL_HOST \(\S+\) does not contain a domain part"