2022-01-12 07:48:18 +00:00
|
|
|
from fastapi import FastAPI, Depends
|
2022-01-17 05:26:59 +00:00
|
|
|
from fastapi.middleware.cors import CORSMiddleware
|
2022-01-12 07:48:18 +00:00
|
|
|
from app import auth, user, server
|
2022-01-13 03:11:59 +00:00
|
|
|
from os import getenv
|
2022-01-17 05:26:59 +00:00
|
|
|
app = FastAPI(docs_url="/")
|
|
|
|
|
|
|
|
app.add_middleware(
|
|
|
|
CORSMiddleware,
|
|
|
|
allow_origins=["*"],
|
|
|
|
allow_credentials=True,
|
|
|
|
allow_methods=["*"],
|
|
|
|
allow_headers=["*"],
|
|
|
|
)
|
2021-09-12 08:45:44 +00:00
|
|
|
|
2022-01-13 03:11:59 +00:00
|
|
|
dependencies = list()
|
|
|
|
if not getenv('DISABLE_AUTH'):
|
|
|
|
dependencies.append(Depends(auth.authorise))
|
2022-01-12 07:48:18 +00:00
|
|
|
app.include_router(auth.router)
|
|
|
|
app.include_router(user.router)
|
2022-01-13 03:11:59 +00:00
|
|
|
app.include_router(server.router, dependencies=dependencies)
|