22 lines
622 B
JavaScript
22 lines
622 B
JavaScript
import stream from './src/stream.js';
|
|
import getConfig from './util/getConfig.js';
|
|
import logger from 'pino';
|
|
import getArcs from './db/querys/getArcs.js';
|
|
|
|
console.logger = logger();
|
|
|
|
async function main(arcId) {
|
|
const conf = getConfig();
|
|
for (let arc of await getArcs()) {
|
|
const config = Object.assign({}, conf, arc);
|
|
if (arcId && arcId != arc.arcId) continue;
|
|
console.logger.info(`ARC_ID:${config.arcId} is running...`);
|
|
stream(config, e => {
|
|
console.logger.error(e);
|
|
setTimeout(main, config.reconnectInterval, config.arcId);
|
|
});
|
|
}
|
|
}
|
|
|
|
main();
|