INNER CODE UNIT · Python
_cors_allow_origin_regex
wzn1118/AsteriaAnalyst · backend/app/main.py:105
def _cors_allow_origin_regex() -> str | None:
return os.getenv("ASTERIA_CORS_ALLOW_ORIGIN_REGEX") or r"https?://(?:localhost|127\.0\.0\.1)(?::\d+)?"
app.add_middleware(
CORSMiddleware,
allow_origins=_cors_allow_origins(),
allow_origin_regex=_cors_allow_origin_regex(),
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.mount("/storage", StaticFiles(directory=PUBLIC_ARTIFACTS_DIR), name="storage")
@app.on_event("startup")
def _start_analysis_lab_pdca_scheduler() -> None: