- Adds parameter to cli methods to be able to specify the location of services modules. This is useful for packages that wrap bitcore-node to be able to pass along a node_modules directory with services. - Adds another parameter for including additional services in the default settings. - Will use the `process.env.HOME + '/.bitcore` as the default configuration location. - There are now two `getDefaultConfig`, one that will instatiate a `~/.bitcore` directory with a default if it doesn't exist, and `getBaseDefaultConfig` that will return a basic configuration without additional services enabled. - Changes logic to use the global install if a local node_modules version is not available, this would previously assume that it was a local install because of the existence of a configuration file.
40 lines
912 B
JavaScript
40 lines
912 B
JavaScript
'use strict';
|
|
|
|
var Liftoff = require('liftoff');
|
|
|
|
function main(parentServicesPath, additionalServices) {
|
|
|
|
var liftoff = new Liftoff({
|
|
name: 'bitcored',
|
|
moduleName: 'bitcore-node',
|
|
configName: 'bitcore-node',
|
|
processTitle: 'bitcored'
|
|
}).on('require', function (name, module) {
|
|
console.log('Loading:', name);
|
|
}).on('requireFail', function (name, err) {
|
|
console.log('Unable to load:', name, err);
|
|
}).on('respawn', function (flags, child) {
|
|
console.log('Detected node flags:', flags);
|
|
console.log('Respawned to PID:', child.pid);
|
|
});
|
|
|
|
liftoff.launch({
|
|
cwd: process.cwd()
|
|
}, function(env){
|
|
|
|
var node;
|
|
|
|
if (typeof env.modulePath === 'undefined') {
|
|
node = require('../../');
|
|
node.cli.daemon(parentServicesPath, additionalServices);
|
|
} else {
|
|
node = require(env.modulePath);
|
|
node.cli.daemon();
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
module.exports = main;
|