From 42c4d600d0bbec727cdf770849be339ca4552af5 Mon Sep 17 00:00:00 2001 From: Gagan Trivedi Date: Sat, 15 Aug 2026 16:03:47 +0530 Subject: [PATCH] feat: wire up the edge_proxy private app Detects the edge_proxy app and mounts its two URL trees: proxy key management for organisation admins, and the environment inventory that Edge Proxy instances poll. The feature is for self-hosted and private cloud only. SaaS images ship the private wheel, so the mount is gated on is_saas() at runtime rather than on the app being absent; the app's own views carry a matching permission as defence in depth. --- api/app/settings/common.py | 4 ++++ api/app/urls.py | 12 ++++++++++++ api/pyproject.toml | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/api/app/settings/common.py b/api/app/settings/common.py index d298618d533b..8a8b42265a26 100644 --- a/api/app/settings/common.py +++ b/api/app/settings/common.py @@ -1153,6 +1153,10 @@ "USER_FILTER_PARSER": "scim.filters.UserFilterQuery", } +EDGE_PROXY_INSTALLED = importlib.util.find_spec("edge_proxy") is not None +if EDGE_PROXY_INSTALLED: + INSTALLED_APPS.append("edge_proxy") + DEFAULT_AUTO_FIELD = "django.db.models.AutoField" # Used to keep edge identities in sync by forwarding the http requests diff --git a/api/app/urls.py b/api/app/urls.py index 1b45a36d8732..866c5d917ba0 100644 --- a/api/app/urls.py +++ b/api/app/urls.py @@ -1,6 +1,7 @@ import importlib from common.core.urls import urlpatterns as core_urlpatterns +from common.core.utils import is_saas from django.conf import settings from django.contrib import admin from django.urls import include, path, re_path @@ -124,6 +125,17 @@ ), ] +# Self-hosted / private-cloud only: SaaS images ship the private wheel, so the +# runtime is_saas() check is the gate, not the module's presence. +if settings.EDGE_PROXY_INSTALLED and not is_saas(): # pragma: no cover + urlpatterns += [ + path( + "api/v1/organisations//edge-proxy/", + include("edge_proxy.management_urls"), + ), + path("api/v1/proxy/", include("edge_proxy.urls")), + ] + if settings.WORKFLOWS_LOGIC_INSTALLED: # pragma: no cover workflow_views = importlib.import_module("workflows_logic.views") urlpatterns += [ diff --git a/api/pyproject.toml b/api/pyproject.toml index f2286d58f45e..ec922cceac25 100644 --- a/api/pyproject.toml +++ b/api/pyproject.toml @@ -507,6 +507,10 @@ ignore_missing_imports = true module = ["rbac.*"] ignore_missing_imports = true +[[tool.mypy.overrides]] +module = ["edge_proxy.*"] +ignore_missing_imports = true + [[tool.mypy.overrides]] module = ["saml.*"] ignore_missing_imports = true