feat: use env values instead of hardcoded

This commit is contained in:
swve 2023-04-13 00:24:37 +02:00 committed by Badr B
parent 0935744915
commit 6198fd2b93

6
app.py
View file

@ -32,12 +32,10 @@ app = FastAPI(
root_path="/" root_path="/"
) )
origin_regex = re.compile(r"^http://[\w.-]+\.localhost:3000$")
app.add_middleware( app.add_middleware(
CORSMiddleware, CORSMiddleware,
allow_origin_regex=str(origin_regex.pattern), allow_origin_regex=learnhouse_config.hosting_config.allowed_regexp,
allow_origins=["http://localhost:3000", "http://localhost:3001"], allow_origins=learnhouse_config.hosting_config.allowed_origins,
allow_methods=["*"], allow_methods=["*"],
allow_credentials=True, allow_credentials=True,
allow_headers=["*"] allow_headers=["*"]