API/app/main.py

21 lines
547 B
Python
Executable File

from fastapi import FastAPI, Depends
from fastapi.middleware.cors import CORSMiddleware
from app import auth, user, server
from os import getenv
app = FastAPI(docs_url="/")
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
dependencies = list()
if not getenv('DISABLE_AUTH'):
dependencies.append(Depends(auth.authorise))
app.include_router(auth.router)
app.include_router(user.router)
app.include_router(server.router, dependencies=dependencies)