Files
image-derivatives-generatio…/dist/main.js
T
2025-11-08 18:27:51 +09:00

33 lines
1.1 KiB
JavaScript

import { secrets } from './secret-manager.js';
import { MinioClient } from './minio.js';
import { NatsClient } from './nats.js';
import { FFmpegConverter } from './ffmpeg.js';
import { ImageDerivativesGenerator } from './image-derivaties-generator.js';
async function main() {
try {
console.log('🔐 Secrets loaded');
console.log(secrets);
// Initialize clients
const minioClient = new MinioClient();
const natsClient = new NatsClient();
const ffmpegConverter = new FFmpegConverter();
// Connect to NATS
await natsClient.connect();
// Create and start the service
const generator = new ImageDerivativesGenerator(minioClient, natsClient, ffmpegConverter);
await generator.start();
// Handle graceful shutdown
const shutdown = async () => {
await generator.stop();
process.exit(0);
};
process.on('SIGINT', shutdown);
process.on('SIGTERM', shutdown);
}
catch (error) {
console.error('❌ Failed to start service:', error);
process.exit(1);
}
}
main();
//# sourceMappingURL=main.js.map