Add enva to disable auth

This commit is contained in:
Jimmy 2022-01-13 03:11:59 +00:00
parent b6f41f4d0a
commit 7307abf7d8
1 changed files with 5 additions and 2 deletions

View File

@ -1,8 +1,11 @@
from fastapi import FastAPI, Depends from fastapi import FastAPI, Depends
from app import auth, user, server from app import auth, user, server
from os import getenv
app = FastAPI() app = FastAPI()
dependencies = list()
if not getenv('DISABLE_AUTH'):
dependencies.append(Depends(auth.authorise))
app.include_router(auth.router) app.include_router(auth.router)
app.include_router(user.router) app.include_router(user.router)
app.include_router(server.router, dependencies=[Depends(auth.authorise)]) app.include_router(server.router, dependencies=dependencies)