Skip to content

Commit

Permalink
add cors support
Browse files Browse the repository at this point in the history
  • Loading branch information
geraldoramos committed Mar 24, 2023
1 parent f91c21c commit 8f5a5e6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions maestro_worker_python/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from fastapi.responses import JSONResponse
from starlette.concurrency import run_in_threadpool
from importlib.machinery import SourceFileLoader
from fastapi.middleware.cors import CORSMiddleware

from .config import settings
from .response import ValidationError, WorkerResponse
Expand All @@ -25,6 +26,17 @@

app = FastAPI()

origins = ["*"]

app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)


logging.basicConfig(level=settings.log_level.upper())

if settings.enable_json_logging:
Expand Down

0 comments on commit 8f5a5e6

Please sign in to comment.