import stream from './src/stream.js'; import yml from 'require-yml'; import path from 'path'; import fs from 'fs-extra'; function main() { const {pathname: root} = new URL('./', import.meta.url); let conf = yml(path.join(root, 'config.yml')); const localConfFile = path.join(root, 'config.local.yml'); if (fs.existsSync(localConfFile)) conf = Object.assign({}, conf, yml(localConfFile)); try { stream(conf); } catch (e) { // Not working setTimeout(main(), conf.reconnectInterval); console.log('MAIN_ERROR', e); } } main();