Skip to content

Commit 79e10f2

Browse files
authored
feat: add CORS_ALLOW_ALL
1 parent 6e424c8 commit 79e10f2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fhirsnake/server.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22
import uuid
33

44
from fastapi import FastAPI, HTTPException
5+
from fastapi.middleware.cors import CORSMiddleware
56
from initial_resources import get_initial_resources
67

78
logging.basicConfig(level=logging.INFO)
89

910

1011
app = FastAPI()
1112

13+
if os.getenv("CORS_ALLOW_ALL", "false").lower() == "true":
14+
app.add_middleware(
15+
CORSMiddleware,
16+
allow_origins=["*"],
17+
allow_credentials=True,
18+
allow_methods=["*"],
19+
allow_headers=["*"],
20+
)
1221

1322
@app.on_event("startup")
1423
async def load_app_data():

0 commit comments

Comments
 (0)