network chunk v18
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
import { workerData, parentPort } from 'worker_threads';
|
||||
import { BackupRetrievalWorker} from '../helpers/backup_retrieval'; // Assuming the class is in the same folder
|
||||
import { BackupRetrievalWorker } from '../helpers/backup_retrieval';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
// Destructure the data passed from the WorkerManager
|
||||
const {
|
||||
userConfigPath,
|
||||
applicationInfoPath,
|
||||
clientPort,
|
||||
destinationPath
|
||||
}: {
|
||||
userConfigPath: string,
|
||||
applicationInfoPath: string,
|
||||
clientPort: number,
|
||||
destinationPath: string
|
||||
} = workerData;
|
||||
// Load environment variables from .env file if it exists
|
||||
dotenv.config();
|
||||
|
||||
// Retrieve configuration from environment variables
|
||||
const userConfigPath = process.env.USER_CONFIG_PATH as string;
|
||||
const applicationInfoPath = process.env.APPLICATION_INFO_PATH as string;
|
||||
const clientPort = Number(process.env.CLIENT_PORT);
|
||||
const destinationPath = process.env.DESTINATION_PATH as string;
|
||||
|
||||
// Validate that all required environment variables are present
|
||||
if (!userConfigPath || !applicationInfoPath || !clientPort || !destinationPath) {
|
||||
console.error('Error: Missing required environment variables.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Initialize the BackupRetrievalWorker
|
||||
const backupRetrievalWorker = new BackupRetrievalWorker(
|
||||
|
||||
Reference in New Issue
Block a user