File tree Expand file tree Collapse file tree 3 files changed +31
-2
lines changed
Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 55
66config = getConfig ()
77app = FastAPI ()
8+
9+
10+ @app .on_event ("startup" )
11+ async def startup () -> None :
12+ if not config .database .is_connected :
13+ await config .database .connect ()
14+
15+
16+ @app .on_event ("shutdown" )
17+ async def shutdown () -> None :
18+ if config .database .is_connected :
19+ await config .database .disconnect ()
20+
21+
822app .mount ("/api/v1" , api )
Original file line number Diff line number Diff line change 11from fastapi import FastAPI
2- from freenit . config import getConfig
2+
33from .api import api
4+ from .config import getConfig
45
56config = getConfig ()
67app = FastAPI ()
8+
9+
10+ @app .on_event ("startup" )
11+ async def startup () -> None :
12+ if not config .database .is_connected :
13+ await config .database .connect ()
14+
15+
16+ @app .on_event ("shutdown" )
17+ async def shutdown () -> None :
18+ if config .database .is_connected :
19+ await config .database .disconnect ()
20+
21+
722app .mount ("/api/v1" , api )
Original file line number Diff line number Diff line change 1- version = "0.2.18 "
1+ version = "0.2.19 "
You can’t perform that action at this time.
0 commit comments