File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ class Settings(BaseSettings):
1212 )
1313 env : str = Field (default = "development" , json_schema_extra = {"env" : "APP_ENV" })
1414
15+ cors_allowed_origins : str = Field (
16+ default = "" , json_schema_extra = {"env" : "CORS_ALLOWED_ORIGINS" }
17+ )
18+
1519 # Keycloak / OIDC
1620 keycloak_host : str = Field (
1721 default = str ("localhost" ),
Original file line number Diff line number Diff line change 11from fastapi import FastAPI
2+ from fastapi .middleware .cors import CORSMiddleware
23
34from app .middleware .correlation_id import add_correlation_id
45from app .platforms .dispatcher import load_processing_platforms
1819 version = "1.0.0" ,
1920)
2021
22+ app .add_middleware (
23+ CORSMiddleware ,
24+ allow_origins = settings .cors_allowed_origins .split ("," ),
25+ allow_credentials = True ,
26+ allow_methods = ["*" ],
27+ allow_headers = ["*" ],
28+ )
29+
2130app .middleware ("http" )(add_correlation_id )
2231
2332# include routers
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ APP_HOST=0.0.0.0
99APP_PORT=8000
1010APP_ENV=development
1111
12+ # CORS
13+ CORS_ALLOWED_ORIGINS=http://localhost:5173
14+
15+
1216# Database
1317DATABASE_URL=
1418
You can’t perform that action at this time.
0 commit comments