mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-10 20:14:13 -04:00
fix(server): serialize SQLite access and validate storage health
This commit is contained in:
1 parent
b39509a6a3
commit
142c77a27f
5 files changed
+389
-54
No files matched your search
@@ -33,7 +33,9 @@ var app = builder.Build();
|
||||
// Open the database now so an unusable data path fails startup, not the first request.
|
||||
app.Services.GetRequiredService<NestDatabase>();
|
||||
|
||||
app.MapGet("/healthz", () => Results.Ok(new { status = "ok" }));
|
||||
app.MapGet("/healthz", (NestDatabase db) => db.IsHealthy()
|
||||
? Results.Ok(new { status = "ok" })
|
||||
: Results.Json(new { status = "unavailable" }, statusCode: StatusCodes.Status503ServiceUnavailable));
|
||||
|
||||
app.MapGet("/api/nests", (NestDatabase db) => Results.Ok(db.List()));
|
||||
|
||||
|
||||
Reference in new issue
Block a user