Skip to content

Commit 2b4b6f4

Browse files
committed
feat: wire up the edge_control_plane private app
Installs the app when the flagsmith-private wheel provides it, and mounts its two URL trees outside SaaS: proxy key management under organisations/{id}/edge-proxy/ and the proxy endpoints under api/v1/proxy/.
1 parent 2b5fa4e commit 2b4b6f4

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

api/app/settings/common.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,12 @@
11561156
"USER_FILTER_PARSER": "scim.filters.UserFilterQuery",
11571157
}
11581158

1159+
EDGE_CONTROL_PLANE_INSTALLED = (
1160+
importlib.util.find_spec("edge_control_plane") is not None
1161+
)
1162+
if EDGE_CONTROL_PLANE_INSTALLED:
1163+
INSTALLED_APPS.append("edge_control_plane")
1164+
11591165
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
11601166

11611167
# Used to keep edge identities in sync by forwarding the http requests

api/app/urls.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import importlib
22

33
from common.core.urls import urlpatterns as core_urlpatterns
4+
from common.core.utils import is_saas
45
from django.conf import settings
56
from django.contrib import admin
67
from django.urls import include, path, re_path
@@ -124,6 +125,16 @@
124125
),
125126
]
126127

128+
# SaaS images ship the private wheel, so is_saas() is the gate, not module presence.
129+
if settings.EDGE_CONTROL_PLANE_INSTALLED and not is_saas(): # pragma: no cover
130+
urlpatterns += [
131+
path(
132+
"api/v1/organisations/<int:organisation_pk>/edge-proxy/",
133+
include("edge_control_plane.management_urls"),
134+
),
135+
path("api/v1/proxy/", include("edge_control_plane.urls")),
136+
]
137+
127138
if settings.WORKFLOWS_LOGIC_INSTALLED: # pragma: no cover
128139
workflow_views = importlib.import_module("workflows_logic.views")
129140
urlpatterns += [

api/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ ignore_missing_imports = true
242242
module = ["rbac.*"]
243243
ignore_missing_imports = true
244244

245+
[[tool.mypy.overrides]]
246+
module = ["edge_control_plane.*"]
247+
ignore_missing_imports = true
248+
245249
[[tool.mypy.overrides]]
246250
module = ["saml.*"]
247251
ignore_missing_imports = true

0 commit comments

Comments
 (0)