generated from Luis/nextjs-python-web-template
Merge pull request 'added middleware for emulation' (#76) from georgdeamon into main
Reviewed-on: #76
This commit was merged in pull request #76.
This commit is contained in:
@@ -5,7 +5,11 @@ cors_url = [
|
||||
"http://0.0.0.0",
|
||||
"http://[::]",
|
||||
]
|
||||
cors_ports = ["*", 3000, 2979]
|
||||
cors_ports = ["*", 3000, 2979, 8001, 8002]
|
||||
cors_whitelist = []
|
||||
for u in cors_url:
|
||||
for p in cors_ports:
|
||||
cors_whitelist.append(f"{u}:{p}")
|
||||
|
||||
# host for the server, frontend, backend and emulators
|
||||
host = "127.0.0.1"
|
||||
|
||||
@@ -6,6 +6,7 @@ from datetime import datetime
|
||||
|
||||
# Importing FastAPI and related components
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import HTMLResponse, JSONResponse
|
||||
|
||||
# Importing configuration and schemas from the clan_cli package
|
||||
@@ -25,6 +26,14 @@ apps = [
|
||||
(app_c1, config.c1_port),
|
||||
(app_c2, config.c2_port),
|
||||
]
|
||||
for app, port in apps:
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=config.cors_whitelist,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
|
||||
# Healthcheck endpoints for different applications
|
||||
|
||||
Reference in New Issue
Block a user