fcoin/bin/wallet
Javed Khan 7f4494e278
multi: pass new Node option file to wallet plugin
`file` is similar to `config`, but it propogates to the wallet plugin
and loads the wallet config file only if set to true.

This is useful to disable config files for both node and wallet when
running a full node, for example in a test environment.
2018-08-13 17:36:21 +05:30

48 lines
957 B
JavaScript
Executable File

#!/usr/bin/env node
'use strict';
process.title = 'bwallet';
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) {
const pkg = require('../package.json');
console.log(pkg.version);
process.exit(0);
throw new Error('Could not exit.');
}
const Node = require('../lib/wallet/node');
const node = new Node({
file: true,
argv: true,
env: true,
logFile: true,
logConsole: true,
logLevel: 'debug',
memory: false,
workers: true,
listen: true,
loader: require
});
process.on('unhandledRejection', (err, promise) => {
throw err;
});
(async () => {
await node.ensure();
await node.open();
})().catch((err) => {
console.error(err.stack);
process.exit(1);
});