diff --git a/engine/engine/integrations_urls.py b/engine/engine/integrations_urls.py new file mode 100644 index 00000000..7ea1bda2 --- /dev/null +++ b/engine/engine/integrations_urls.py @@ -0,0 +1,9 @@ +from django.urls import URLPattern, URLResolver, include, path + +from .urls import paths_to_work_even_when_maintenance_mode_is_active + +urlpatterns: list[URLPattern | URLResolver] = paths_to_work_even_when_maintenance_mode_is_active + +urlpatterns += [ + path("integrations/v1/", include("apps.integrations.urls", namespace="integrations")), +] diff --git a/engine/engine/urls.py b/engine/engine/urls.py index 06faf004..c86a9a74 100644 --- a/engine/engine/urls.py +++ b/engine/engine/urls.py @@ -15,20 +15,24 @@ Including another URLconf """ from django.conf import settings from django.conf.urls.static import static -from django.urls import include, path +from django.urls import URLPattern, URLResolver, include, path from .views import HealthCheckView, MaintenanceModeStatusView, ReadinessCheckView, StartupProbeView -paths_to_work_even_when_maintenance_mode_is_active = [ +paths_to_work_even_when_maintenance_mode_is_active: list[URLPattern | URLResolver] = [ path("", HealthCheckView.as_view()), path("health/", HealthCheckView.as_view()), path("ready/", ReadinessCheckView.as_view()), path("startupprobe/", StartupProbeView.as_view()), - path("integrations/v1/", include("apps.integrations.urls", namespace="integrations")), path("api/internal/v1/maintenance-mode-status", MaintenanceModeStatusView.as_view()), ] -urlpatterns = [ +if not settings.DETACHED_INTEGRATIONS_SERVER: + paths_to_work_even_when_maintenance_mode_is_active += [ + path("integrations/v1/", include("apps.integrations.urls", namespace="integrations")), + ] + +urlpatterns: list[URLPattern | URLResolver] = [ *paths_to_work_even_when_maintenance_mode_is_active, path("api/gi/v1/", include("apps.api_for_grafana_incident.urls", namespace="api-gi")), path("api/internal/v1/", include("apps.api.urls", namespace="api-internal")), diff --git a/engine/settings/base.py b/engine/settings/base.py index 339e88eb..260c4f96 100644 --- a/engine/settings/base.py +++ b/engine/settings/base.py @@ -373,7 +373,7 @@ LOGGING = { }, } -ROOT_URLCONF = "engine.urls" +ROOT_URLCONF = os.environ.get("ROOT_URLCONF", "engine.urls") TEMPLATES = [ { @@ -831,3 +831,5 @@ ZVONOK_POSTBACK_CAMPAIGN_ID = os.getenv("ZVONOK_POSTBACK_CAMPAIGN_ID", "campaign ZVONOK_POSTBACK_STATUS = os.getenv("ZVONOK_POSTBACK_STATUS", "status") ZVONOK_POSTBACK_USER_CHOICE = os.getenv("ZVONOK_POSTBACK_USER_CHOICE", None) ZVONOK_POSTBACK_USER_CHOICE_ACK = os.getenv("ZVONOK_POSTBACK_USER_CHOICE_ACK", None) + +DETACHED_INTEGRATIONS_SERVER = getenv_boolean("DETACHED_INTEGRATIONS_SERVER", default=False)