[enh] add BMA watcher + reorganize code

This commit is contained in:
2019-06-08 18:34:39 +02:00
parent d02de7842f
commit 5544d56ebb
13 changed files with 232 additions and 606 deletions

View File

@@ -1,12 +1,14 @@
import {Conf} from './conf'
import {Conf} from './types/conf'
import * as yaml from 'js-yaml';
import * as fs from 'fs';
import {ws2pWatcher} from "./ws2p/ws2p-watcher";
import {ws2pWatcher} from "./watchers/ws2p/ws2p-watcher";
import {bmaWatcher} from "./watchers/bma/bma-watcher";
export async function dwatch(confFile: string) {
const yml = fs.readFileSync(confFile, 'utf8')
const conf = yaml.load(yml) as Conf
await Promise.all(conf.ws2pServers.map(ws2pWatcher(conf)))
await Promise.all((conf.ws2pServers || []).map(ws2pWatcher(conf)))
await Promise.all((conf.bmaServers || []).map(bmaWatcher(conf)))
}