diogenes-electrician

Adapter to use electrician components in diogenes

Usage no npm install needed!

<script type="module">
  import diogenesElectrician from 'https://cdn.skypack.dev/diogenes-electrician';
</script>

README

diogenes-electrician

This is an adapter for using electrician components in Diogenes.

addElectricComponents

It adds a set of electric components to 2 Diogenes registry. The first one can be used to start the services in order, the second one to stop them in the opposite order.

var diogenesElectrician = require('diogenes-electrician');
var Diogenes = require('diogenes');

var registry = Diogenes.getRegistry();
var stopRegistry = Diogenes.getRegistry();
// components is an object name->electrician component
diogenesElectrician.addElectricComponents(registry, stopRegistry, components);

Then you can start a component using the diogenes "registry" API:

registry.run('componentName', function (err, res) {
  // ...
});

and stop with:

stopRegistry.run('componentName', function (err, res) {
  // ...
});

system

It emulates the electrician "system" api:

var diogenesElectrician = require('diogenes-electrician');
var system = diogenesElectrician.system(components);

system.start(function () {
  // ...
});

and stop:

system.stop(function () {
  // ...
});