-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
37 lines (32 loc) · 1.04 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from modules import settings, daemon, database
from modules.fastapi import main_router, initialise_fastapi_cache, generate_unique_id
from modules.fastapi.middleware import middlewares
import uvicorn
from fastapi import FastAPI
app = FastAPI(
title="Open Booru",
version="Lithium",
docs_url='/docs',
middleware=middlewares,
generate_unique_id_function=generate_unique_id,
responses={
200: {"description":"Success"},
401: {"description":"Account Required"},
403: {"description":"Missing Permission"},
429: {"description":"Rate limitted"},
},
)
app.include_router(main_router)
@app.on_event("startup")
async def startup_event():
initialise_fastapi_cache()
daemon.run_daemon()
if __name__ == "__main__":
uvicorn.run(
"app:app",
host='0.0.0.0',
port=settings.PORT,
log_config="./data/logging.conf",
ssl_keyfile=settings.SSL_KEY_STORE if settings.SSL_ENABLED else None,
ssl_certfile=settings.SSL_CERT_STORE if settings.SSL_ENABLED else None,
)