There was an error while loading. Please reload this page.
1 parent 153b352 commit 60c1690Copy full SHA for 60c1690
1 file changed
backend/src/acidwatch_api/app.py
@@ -1,5 +1,7 @@
1
from __future__ import annotations
2
3
+import os
4
+
5
import fastapi
6
from azure.monitor.opentelemetry import configure_azure_monitor
7
from fastapi.middleware.cors import CORSMiddleware
@@ -39,6 +41,13 @@
39
41
"https://acidwatch.radix.equinor.com",
40
42
]
43
44
+# Allow CORS for GitHub Codespaces if running in that environment
45
+if codespace_name := os.environ.get("CODESPACE_NAME"):
46
+ domain = os.environ.get(
47
+ "GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN", "app.github.dev"
48
+ )
49
+ origins.append(f"https://{codespace_name}-5173.{domain}")
50
51
52
fastapi_app.include_router(router)
53
0 commit comments