chore(api): harden /api/media/audio with config checks and clearer errors
This commit is contained in:
parent
7f127bf721
commit
4dffb86ca8
@ -11,6 +11,12 @@ router.post('/audio', upload.single('audio'), async (
|
||||
res: express.Response
|
||||
) => {
|
||||
try {
|
||||
const { S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY } = process.env;
|
||||
if (!S3_ENDPOINT || !S3_ACCESS_KEY || !S3_SECRET_KEY) {
|
||||
console.error('Upload failed: missing S3 config (S3_ENDPOINT/S3_ACCESS_KEY/S3_SECRET_KEY)');
|
||||
return res.status(500).json({ error: 'Object storage not configured' });
|
||||
}
|
||||
|
||||
if (!req.file) return res.status(400).json({ error: 'No audio file' });
|
||||
|
||||
const bucket = process.env.S3_BUCKET || 'voxblog';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user