diff --git a/src/coulobre/hosting/installation_views.py b/src/coulobre/hosting/installation_views.py
index 8c437e1..24544c1 100644
--- a/src/coulobre/hosting/installation_views.py
+++ b/src/coulobre/hosting/installation_views.py
@@ -7,6 +7,7 @@ from django.views.decorators.cache import never_cache
from django.views.generic import TemplateView
from .access import OperatorOnlyMixin
+from .dns_defaults import zone_defaults
@method_decorator(never_cache, name="dispatch")
@@ -22,6 +23,7 @@ class InstallationView(
except PackageNotFoundError:
installed_version = "Unavailable"
+ dns_defaults = zone_defaults()
features = (
("Local website provisioning", settings.LOCAL_WEB_ACTIVATION),
("Managed website certificates", settings.LOCAL_WEB_HTTPS),
@@ -31,8 +33,8 @@ class InstallationView(
(
"Default managed DNS zones for new accounts",
settings.LOCAL_DNS_PUBLISHING
- and settings.HOSTING_NAMESERVERS
- and settings.HOSTING_PUBLIC_ADDRESSES,
+ and dns_defaults.nameservers
+ and dns_defaults.addresses,
),
(
"Local mailbox provisioning",
diff --git a/src/coulobre/hosting/templates/hosting/installation.html b/src/coulobre/hosting/templates/hosting/installation.html
index 29e1477..866dab3 100644
--- a/src/coulobre/hosting/templates/hosting/installation.html
+++ b/src/coulobre/hosting/templates/hosting/installation.html
@@ -25,7 +25,14 @@
{% for name, enabled in features %}
| {{ name }} |
- {% if enabled %}Enabled{% else %}Disabled{% endif %} |
+
+
+ {% if enabled %} Enabled{% else %} Disabled{% endif %}
+ {% if request.user.is_superuser and name == 'Default managed DNS zones for new accounts' %}
+ Configure DNS defaults
+ {% endif %}
+
+ |
{% endfor %}
diff --git a/src/coulobre/hosting/test_service_health.py b/src/coulobre/hosting/test_service_health.py
index 99e8d4c..4a6e300 100644
--- a/src/coulobre/hosting/test_service_health.py
+++ b/src/coulobre/hosting/test_service_health.py
@@ -20,7 +20,7 @@ from coulobre.service_health import (
main,
)
-from .models import Customer, Reseller, ServiceHealth
+from .models import Customer, DnsZoneDefaults, Reseller, ServiceHealth
TARGETS = (
HealthTarget("panel-01", "local", ("mariadb", "apache")),
@@ -196,6 +196,24 @@ class ServiceHealthPanelTests(TestCase):
self.assertNotContains(response, "test-only-bridge-key")
self.assertNotContains(response, "https://webmail.example.net")
+ @override_settings(
+ LOCAL_DNS_PUBLISHING=True,
+ HOSTING_NAMESERVERS=(),
+ HOSTING_PUBLIC_ADDRESSES=(),
+ )
+ def test_installation_reports_dns_defaults_saved_in_the_panel(self):
+ DnsZoneDefaults.objects.create(
+ pk=1, nameservers=["ns.example.net"], addresses=["192.0.2.20"]
+ )
+ self.client.force_login(self.admin)
+ response = self.client.get(reverse("panel:installation"))
+ self.assertTrue(
+ dict(response.context["features"])[
+ "Default managed DNS zones for new accounts"
+ ]
+ )
+ self.assertContains(response, "Configure DNS defaults")
+
def test_view_marks_missing_and_old_observations_distinctly(self):
now = timezone.now()
for node, service, result, observed_at in (