Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
Merge branch 'feature/api-cors'
Browse files Browse the repository at this point in the history
  • Loading branch information
emi420 committed Dec 15, 2023
2 parents 73dd464 + 90c5935 commit fd90a4d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
9 changes: 8 additions & 1 deletion python/restapi/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import os

# ENABLE_UNDERPASS_CORE=True
UNDERPASS_DB=os.getenv("UNDERPASS_API_DB") or "postgresql://localhost/underpass"
UNDERPASS_DB=os.getenv("UNDERPASS_API_DB") or "postgresql://localhost/underpass"
ORIGINS = os.getenv("UNDERPASS_API_ORIGINS").split(",") if os.getenv("UNDERPASS_API_ORIGINS") else [
"http://localhost",
"http://localhost:5000",
"http://localhost:3000",
"http://127.0.0.1",
"http://127.0.0.1:5000"
]
10 changes: 1 addition & 9 deletions python/restapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,11 @@
import config
import json

origins = [
"http://localhost",
"http://localhost:5000",
"http://localhost:3000",
"http://127.0.0.1",
"http://127.0.0.1:5000"
]

app = FastAPI()

app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_origins=config.ORIGINS,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"]
Expand Down

0 comments on commit fd90a4d

Please sign in to comment.