msgflo
Version:
Polyglot FBP runtime based on message queues
62 lines (45 loc) • 2.62 kB
JavaScript
var collectArray, common, main, program, runtime;
runtime = require('./runtime');
common = require('./common');
//# Main
program = require('commander');
collectArray = function(val, list) {
list.push(val);
return list;
};
main = function() {
var options, originalOption, r;
// Include default into description, so it shows in --help
originalOption = program.option;
program.option = function(flags, desc, type, def) {
if (def.toString()) {
desc += `. Default: ${JSON.stringify(def)}`;
}
originalOption.call(this, flags, desc, type, def);
return program;
};
program.option('--host <hostname>', 'Host', String, 'localhost').option('--port <port>', 'Port', Number, 3569).option('--broker <uri>', 'Broker address', String, '').option('--ide <uri>', 'FBP IDE address', String, 'http://app.flowhub.io').option('--library <FILE.json>', 'Library configuration file', String, 'package.json').option('--componentdir <dirname>', 'Library directory', String, '').option('--graph <file.json>', 'Initial graph to load', String, '').option('--ignore [process]', "Don't set up these processes", collectArray, []).option('--forward <stderr,stdout>', "Forward these streams from child", String, 'stderr,stdout').option('--auto-save [true|false]', "Autosave changes to graph", Boolean, false).option('--wait-timeout <seconds>', "How long to wait for participants", Number, 45).option('--runtime-id <UUID>', 'Unique identifier for this runtime instance', String, '').option('--ping-url <URL>', 'An URL that will be pinged periodically', String, 'https://api.flowhub.io/runtimes/$RUNTIME_ID').option('--ping-method <GET|POST>', 'HTTP method to hit ping URL with', String, 'POST').option('--ping-interval <seconds>', 'How often to hit the ping URL, 0=never', Number, 0);
program = program.parse(process.argv);
options = common.normalizeOptions(program);
r = new runtime.Runtime(options);
return r.start(function(err, address, liveUrl) {
if (err) {
throw err;
}
console.log(`msgflo started on ${address}`);
return console.log('Open in Flowhub: ' + liveUrl);
});
};
exports.main = main;
exports.transport = require('msgflo-nodejs').transport;
exports.participant = require('msgflo-nodejs').participant;
exports.foreignParticipant = require('./foreign-participant');
exports.coordinator = require('./coordinator');
exports.runtime = require('./runtime');
exports.common = require('./common');
exports.setup = require('./setup');
exports.library = require('./library');
exports.procfile = require('./procfile');
exports.utils = {
spy: require('./utils/spy')
};