2024-02-22 06:15:16 +00:00
|
|
|
import dotenv from 'dotenv';
|
|
|
|
dotenv.config();
|
|
|
|
|
2024-02-23 06:18:00 +00:00
|
|
|
import WorkflowOrchestrator from './workflows/WorkflowOrchestrator';
|
|
|
|
import SessionManager from './rdrama/session/SessionManager';
|
|
|
|
import { CommentFetcher } from './rdrama/services/CommentFetcher';
|
|
|
|
import { CommentParser } from './rdrama/services/CommentParser';
|
|
|
|
// Import other necessary services or configurations
|
2024-02-22 06:15:16 +00:00
|
|
|
|
2024-02-23 06:18:00 +00:00
|
|
|
async function startApplication() {
|
|
|
|
// Initialize SessionManager or other global configurations
|
|
|
|
const sessionManager = SessionManager.getInstance();
|
|
|
|
if (!process.env.RDRAMA_API_KEY) {
|
|
|
|
throw new Error('RDRAMA_API_KEY is undefined. Please set this environment variable.');
|
|
|
|
}
|
|
|
|
sessionManager.setAuthorizationToken(process.env.RDRAMA_API_KEY);
|
|
|
|
|
|
|
|
// Initialize services with any required dependencies
|
|
|
|
const commentFetcher = new CommentFetcher();
|
|
|
|
const commentParser = new CommentParser();
|
|
|
|
|
|
|
|
// Initialize and start your workflow
|
|
|
|
const workflowOrchestrator = new WorkflowOrchestrator(commentFetcher, commentParser);
|
|
|
|
await workflowOrchestrator.executeWorkflow();
|
|
|
|
}
|
|
|
|
|
|
|
|
startApplication()
|
|
|
|
.then(() => console.log('Application started successfully.'))
|
|
|
|
.catch((error) => console.error('Application failed to start:', error));
|