Spaces:
Sleeping
Sleeping
Commit ·
a4a1f7f
1
Parent(s): 0fba372
debug: add db info to health endpoint
Browse files- backend/app/main.py +11 -1
backend/app/main.py
CHANGED
|
@@ -40,7 +40,17 @@ app.include_router(discover.router)
|
|
| 40 |
|
| 41 |
@app.get("/api/health")
|
| 42 |
def health():
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
|
| 46 |
# Serve built frontend in production (when dist exists)
|
|
|
|
| 40 |
|
| 41 |
@app.get("/api/health")
|
| 42 |
def health():
|
| 43 |
+
import os
|
| 44 |
+
store = deps.get_store()
|
| 45 |
+
total = store.conn.execute("SELECT COUNT(*) FROM products").fetchone()[0]
|
| 46 |
+
cols = [r[1] for r in store.conn.execute("PRAGMA table_info(products)").fetchall()]
|
| 47 |
+
return {
|
| 48 |
+
"status": "ok",
|
| 49 |
+
"db_path": str(store.db_path),
|
| 50 |
+
"total_products": total,
|
| 51 |
+
"columns": cols,
|
| 52 |
+
"data_dir": os.environ.get("TASTE_DATA_DIR", "not set"),
|
| 53 |
+
}
|
| 54 |
|
| 55 |
|
| 56 |
# Serve built frontend in production (when dist exists)
|