[state]: watchers return a state
This commit is contained in:
@@ -5,16 +5,19 @@ import {ws2pWatcher} from "./watchers/ws2p/ws2p-watcher";
|
||||
import {bmaWatcher} from "./watchers/bma/bma-watcher";
|
||||
import {dprobeHeartbeat} from './watchers/dprobe/dprobe-heartbeat-watcher'
|
||||
import {webDiffWatcher} from "./watchers/webdiff/webdiff-watcher";
|
||||
import {ServiceState} from "./types/state";
|
||||
import {Watcher} from "./types/state";
|
||||
|
||||
export async function dwatch(confFile: string) {
|
||||
|
||||
const yml = fs.readFileSync(confFile, 'utf8')
|
||||
const conf = yaml.load(yml) as Conf
|
||||
const states: ServiceState[] = []
|
||||
const watchers: () => Promise<>
|
||||
await Promise.all((conf.ws2pServers || []).map(ws2pWatcher(conf)))
|
||||
await Promise.all((conf.bmaServers || []).map(bmaWatcher(conf)))
|
||||
await Promise.all((conf.dprobeHeartbeats || []).map(dprobeHeartbeat(conf)))
|
||||
await Promise.all((conf.webDiffServers || []).map(webDiffWatcher(conf)))
|
||||
const watchers: Watcher[] = [];
|
||||
(await Promise.all((conf.ws2pServers || []).map(ws2pWatcher(conf)))).forEach(w => watchers.push(w));
|
||||
(await Promise.all((conf.bmaServers || []).map(bmaWatcher(conf)))).forEach(w => watchers.push(w));
|
||||
(await Promise.all((conf.dprobeHeartbeats || []).map(dprobeHeartbeat(conf)))).forEach(w => watchers.push(w));
|
||||
(await Promise.all((conf.webDiffServers || []).map(webDiffWatcher(conf)))).forEach(w => watchers.push(w));
|
||||
return watchers
|
||||
}
|
||||
|
||||
// (await Promise.all((conf.headServers || []).map(headWatcher(conf)))).forEach(w => watchers.push(w));
|
||||
// (await Promise.all((conf.wwMeta || []).map(jsonWatcher(conf)))).forEach(w => watchers.push(w));
|
||||
Reference in New Issue
Block a user