feat: storage abstraction (fs volume default | s3), health via storageOk
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import type { APIRoute } from 'astro';
|
||||
import { pool } from '../../lib/db';
|
||||
import { s3 } from '../../lib/storage';
|
||||
import { HeadBucketCommand } from '@aws-sdk/client-s3';
|
||||
import { storageOk } from '../../lib/storage';
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
@@ -12,12 +11,9 @@ export const GET: APIRoute = async () => {
|
||||
try { await pool.query('SELECT 1'); out.db = 'ok'; }
|
||||
catch { out.db = 'fehler'; ok = false; }
|
||||
|
||||
try {
|
||||
await s3.send(new HeadBucketCommand({ Bucket: process.env.S3_BUCKET || 'klarbild' }));
|
||||
out.storage = 'ok';
|
||||
} catch { out.storage = 'fehler'; ok = false; }
|
||||
out.storage = (await storageOk()) ? 'ok' : 'fehler';
|
||||
if (out.storage !== 'ok') ok = false;
|
||||
|
||||
out.queue = 'todo'; // wird mit pg-boss-Phase geprüft
|
||||
out.status = ok ? 'ok' : 'degraded';
|
||||
return new Response(JSON.stringify(out), {
|
||||
status: ok ? 200 : 503,
|
||||
|
||||
Reference in New Issue
Block a user