diff --git a/scripts/commands/create-queue.js b/scripts/commands/create-queue.js index 318d8159..2d7cdd5b 100644 --- a/scripts/commands/create-queue.js +++ b/scripts/commands/create-queue.js @@ -10,10 +10,11 @@ const options = program 256 ) .option('--days ', 'Number of days for which to grab the program', parser.parseNumber, 1) - .option('--channels ', 'Set path to channels.xml file', 'sites/**/*.channels.xml') .parse(process.argv) .opts() +const CHANNELS_PATH = process.env.CHANNELS_PATH || 'sites/**/*.channels.xml' + async function main() { logger.info('Starting...') logger.info(`Number of clusters: ${options.maxClusters}`) @@ -30,7 +31,7 @@ async function createQueue() { let queue = {} - const files = await file.list(options.channels) + const files = await file.list(CHANNELS_PATH) const utcDate = date.getUTC() const dates = Array.from({ length: options.days }, (_, i) => utcDate.add(i, 'd')) for (const filepath of files) { diff --git a/tests/commands/create-queue.test.js b/tests/commands/create-queue.test.js index f81970db..c6212651 100644 --- a/tests/commands/create-queue.test.js +++ b/tests/commands/create-queue.test.js @@ -7,7 +7,7 @@ beforeEach(() => { fs.mkdirSync('tests/__data__/output') const stdout = execSync( - 'DB_DIR=tests/__data__/output/database node scripts/commands/create-queue.js --channels=tests/__data__/input/sites/*.channels.xml --max-clusters=1 --days=2', + 'DB_DIR=tests/__data__/output/database CHANNELS_PATH=tests/__data__/input/sites/*.channels.xml node scripts/commands/create-queue.js --max-clusters=1 --days=2', { encoding: 'utf8' } ) })