feat: implement a database check on the healthz and readyz probes, remove /-/metrics
This commit is contained in:
		
							parent
							
								
									d5057ab888
								
							
						
					
					
						commit
						35ef010ba9
					
				| @ -1,10 +1,17 @@ | ||||
| import { Router, Response, Request } from "express"; | ||||
| import { route } from "@fosscord/api"; | ||||
| import { getConnection } from "typeorm"; | ||||
| 
 | ||||
| const router = Router(); | ||||
| 
 | ||||
| router.get("/", route({}), (req: Request, res: Response) => { | ||||
| 	res.sendStatus(200); | ||||
| 	try { | ||||
| 		// test that the database is alive & responding
 | ||||
| 		getConnection(); | ||||
| 		return res.sendStatus(200); | ||||
| 	} catch(e) { | ||||
| 		res.sendStatus(503); | ||||
| 	} | ||||
| }); | ||||
| 
 | ||||
| export default router; | ||||
|  | ||||
| @ -1,10 +0,0 @@ | ||||
| import { Router, Response, Request } from "express"; | ||||
| import { route } from "@fosscord/api"; | ||||
| 
 | ||||
| const router = Router(); | ||||
| 
 | ||||
| router.get("/", route({}), (req: Request, res: Response) => { | ||||
| 	res.sendStatus(200); | ||||
| }); | ||||
| 
 | ||||
| export default router; | ||||
| @ -1,10 +1,17 @@ | ||||
| import { Router, Response, Request } from "express"; | ||||
| import { route } from "@fosscord/api"; | ||||
| import { getConnection } from "typeorm"; | ||||
| 
 | ||||
| const router = Router(); | ||||
| 
 | ||||
| router.get("/", route({}), (req: Request, res: Response) => { | ||||
| 	res.sendStatus(200); | ||||
| 	try { | ||||
| 		// test that the database is alive & responding
 | ||||
| 		getConnection(); | ||||
| 		return res.sendStatus(200); | ||||
| 	} catch(e) { | ||||
| 		res.sendStatus(503); | ||||
| 	} | ||||
| }); | ||||
| 
 | ||||
| export default router; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Hayden Young
						Hayden Young