56 lines
1.1 KiB
JavaScript
Executable File
56 lines
1.1 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
'use strict';
|
|
|
|
process.title = 'bcoin';
|
|
|
|
if (process.argv.indexOf('--help') !== -1
|
|
|| process.argv.indexOf('-h') !== -1) {
|
|
console.error('See the bcoin wiki at: https://github.com/bcoin-org/bcoin/wiki.');
|
|
process.exit(1);
|
|
throw new Error('Could not exit.');
|
|
}
|
|
|
|
if (process.argv.indexOf('--version') !== -1
|
|
|| process.argv.indexOf('-v') !== -1) {
|
|
var pkg = require('../package.json');
|
|
console.log(pkg.version);
|
|
process.exit(0);
|
|
throw new Error('Could not exit.');
|
|
}
|
|
|
|
var bcoin = require('../');
|
|
var plugin = require('../lib/wallet/plugin');
|
|
var co = bcoin.co;
|
|
var node;
|
|
|
|
node = new bcoin.fullnode({
|
|
config: true,
|
|
argv: true,
|
|
env: true,
|
|
logFile: true,
|
|
logConsole: true,
|
|
logLevel: 'debug',
|
|
db: 'leveldb',
|
|
persistent: true,
|
|
listen: true,
|
|
loader: require
|
|
});
|
|
|
|
// Temporary hack
|
|
if (!node.config.bool('no-wallet') && !node.has('walletdb'))
|
|
node.use(plugin);
|
|
|
|
node.on('error', function(err) {
|
|
;
|
|
});
|
|
|
|
co.spawn(function *() {
|
|
yield node.ensure();
|
|
yield node.open();
|
|
yield node.connect();
|
|
node.startSync();
|
|
}).catch(function(err) {
|
|
throw err;
|
|
});
|