From 7f4494e278f886eb6963d9b6fb4a3b7b40a0e461 Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Thu, 9 Aug 2018 13:09:54 +0530 Subject: [PATCH] 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. --- bin/node | 2 +- bin/wallet | 2 +- lib/node/node.js | 2 +- lib/wallet/plugin.js | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/node b/bin/node index 4e1f9a314..1eb955b5e 100755 --- a/bin/node +++ b/bin/node @@ -22,7 +22,7 @@ if (process.argv.indexOf('--version') !== -1 const FullNode = require('../lib/node/fullnode'); const node = new FullNode({ - config: true, + file: true, argv: true, env: true, logFile: true, diff --git a/bin/wallet b/bin/wallet index 8630592e5..4cf1d4e2a 100755 --- a/bin/wallet +++ b/bin/wallet @@ -22,7 +22,7 @@ if (process.argv.indexOf('--version') !== -1 const Node = require('../lib/wallet/node'); const node = new Node({ - config: true, + file: true, argv: true, env: true, logFile: true, diff --git a/lib/node/node.js b/lib/node/node.js index be96072f1..a8f9ecb45 100644 --- a/lib/node/node.js +++ b/lib/node/node.js @@ -43,7 +43,7 @@ class Node extends EventEmitter { this.config.inject(options); this.config.load(options); - if (options.config) + if (options.file || options.config) this.config.open(config); this.network = Network.get(this.config.getSuffix()); diff --git a/lib/wallet/plugin.js b/lib/wallet/plugin.js index e20aff97e..f2e6df198 100644 --- a/lib/wallet/plugin.js +++ b/lib/wallet/plugin.js @@ -34,7 +34,9 @@ class Plugin extends EventEmitter { super(); this.config = node.config.filter('wallet'); - this.config.open('wallet.conf'); + + if (node.config.options.file) + this.config.open('wallet.conf'); this.network = node.network; this.logger = node.logger;