xpeditis2.0/scripts/create-minio-bucket.js
David 08787c89c8
Some checks failed
Dev CI / Unit Tests (${{ matrix.app }}) (backend) (push) Blocked by required conditions
Dev CI / Unit Tests (${{ matrix.app }}) (frontend) (push) Blocked by required conditions
Dev CI / Notify Failure (push) Blocked by required conditions
Dev CI / Quality (${{ matrix.app }}) (backend) (push) Has been cancelled
Dev CI / Quality (${{ matrix.app }}) (frontend) (push) Has been cancelled
chore: sync full codebase from cicd branch
Aligns dev with the complete application codebase (cicd branch).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 12:56:16 +02:00

46 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
/**
* Create MinIO bucket for document storage
*
* Usage: node scripts/create-minio-bucket.js
*/
const { S3Client, CreateBucketCommand, HeadBucketCommand } = require('@aws-sdk/client-s3');
const bucketName = 'xpeditis-documents';
const s3Client = new S3Client({
endpoint: 'http://localhost:9000',
region: 'us-east-1',
credentials: {
accessKeyId: 'minioadmin',
secretAccessKey: 'minioadmin',
},
forcePathStyle: true,
});
async function createBucket() {
try {
// Check if bucket already exists
try {
await s3Client.send(new HeadBucketCommand({ Bucket: bucketName }));
console.log(`✅ Bucket '${bucketName}' already exists`);
return;
} catch (error) {
if (error.name !== 'NotFound') {
throw error;
}
}
// Create bucket
await s3Client.send(new CreateBucketCommand({ Bucket: bucketName }));
console.log(`✅ Bucket '${bucketName}' created successfully`);
} catch (error) {
console.error(`❌ Failed to create bucket:`, error.message);
process.exit(1);
}
}
createBucket();