obdfcascrape/nl.js
Martin Donnelly be5d3eae07 init
2019-05-05 20:13:56 +01:00

37 lines
833 B
JavaScript

#!/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 Netherlands = require('./ncas/nl');
async function run() {
const nlScraper = new Netherlands();
if (typeof(process.env.NL_CRON) === 'string' )
new CronJob(process.env.NL_CRON, async function() {
await nlScraper.run();
}, null, true);
if (process.env.SCRAPE_START === nlScraper.id)
await nlScraper.run();
console.log('NL Launched');
}
process.once('uncaughtException', function caught(err) {
console.error('Uncaught', err);
done = true;
});
run();