#!/usr/bin/env node const CronJob = require('cron').CronJob; // load env variables from file require('dotenv').config(); // TODO: // parse arguments - we should run just 1 FCA per go & // have option to run selected company from selected NCA const argv = require('yargs').argv; // load helper libs etc // const Fca = require('./ncas/fca'); const Cyprus = require('./ncas/cy'); async function run() { const cyScraper = new Cyprus(); if (typeof(process.env.CY_CRON) === 'string' ) new CronJob(process.env.CY_CRON, async function() { await cyScraper.run(); }, null, true); if (process.env.SCRAPE_START === cyScraper.id) await cyScraper.run(); console.log('CY Launched'); } process.once('uncaughtException', function caught(err) { console.error('Uncaught', err); }); run();