diff options
author | Quentin <quentin@deuxfleurs.fr> | 2020-02-09 20:09:20 +0100 |
---|---|---|
committer | Quentin <quentin@deuxfleurs.fr> | 2020-02-09 20:09:20 +0100 |
commit | 96c6da392fc3236754c273a299728ad0360b3d51 (patch) | |
tree | db6732c726c731396b482debe329cd5894613d02 /docker/netiquette/src/catalog | |
parent | ba5590ce97953f66702b149fd7840bcb58d4b463 (diff) | |
download | infrastructure-96c6da392fc3236754c273a299728ad0360b3d51.tar.gz infrastructure-96c6da392fc3236754c273a299728ad0360b3d51.zip |
[diplomate] Skeleton for our UPNP configurator
Diffstat (limited to 'docker/netiquette/src/catalog')
-rw-r--r-- | docker/netiquette/src/catalog/consul.mjs | 30 | ||||
-rw-r--r-- | docker/netiquette/src/catalog/control_loop.mjs | 10 |
2 files changed, 0 insertions, 40 deletions
diff --git a/docker/netiquette/src/catalog/consul.mjs b/docker/netiquette/src/catalog/consul.mjs deleted file mode 100644 index 655c61f..0000000 --- a/docker/netiquette/src/catalog/consul.mjs +++ /dev/null @@ -1,30 +0,0 @@ -'use strict' - -let l -export default l = async (node, consul, log, notify) => { - const watch = consul.watch({ method: consul.catalog.node.services, options: {node: node}}) - - const extract_tags = data => - data ? - Object - .keys(data.Services) - .map(k => data.Services[k].Tags) - .reduce((acc, v) => [...acc, ...v], []) : - [] - - watch.on('error', err => { - console.error('error', err) - }) - - watch.on('change', async (data, res) => { - try { - const tags = extract_tags(data) - log(`[consul] new update, detected ${tags.length} tags`) - await notify(tags) - } catch(e) { - console.error('failed to notify target', e) - } - }) - - log('[consul] initialized') -} diff --git a/docker/netiquette/src/catalog/control_loop.mjs b/docker/netiquette/src/catalog/control_loop.mjs deleted file mode 100644 index 56ad6f5..0000000 --- a/docker/netiquette/src/catalog/control_loop.mjs +++ /dev/null @@ -1,10 +0,0 @@ -'use strict' - -let l -export default l = async (timer, interval, notify) => { - timer(() => { - notify([]) - console.log(`[control_loop] actuation (triggered every ${interval} ms)`) - }, interval) - console.log("[control_loop] initialized") -} |