From 2bd641285b72d8d83fdb72d3bfe4f3961c035ec9 Mon Sep 17 00:00:00 2001 From: jash Date: Sat, 6 Oct 2018 22:51:16 +0200 Subject: [PATCH] full node is no longer a feature. Cyphernode needs an internal or external full node to be present --- .../generators/app/features.json | 4 -- .../generators/app/features/100_bitcoin.js | 57 +++++++++++++++++-- 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/install/generator-cyphernode/generators/app/features.json b/install/generator-cyphernode/generators/app/features.json index 0195ce5..533967d 100644 --- a/install/generator-cyphernode/generators/app/features.json +++ b/install/generator-cyphernode/generators/app/features.json @@ -1,8 +1,4 @@ [ - { - "name": "Bitcoin full node", - "value": "bitcoin" - }, { "name": "Lightning node", "value": "lightning" diff --git a/install/generator-cyphernode/generators/app/features/100_bitcoin.js b/install/generator-cyphernode/generators/app/features/100_bitcoin.js index cb93b06..de7148d 100644 --- a/install/generator-cyphernode/generators/app/features/100_bitcoin.js +++ b/install/generator-cyphernode/generators/app/features/100_bitcoin.js @@ -1,6 +1,11 @@ const name = 'bitcoin'; -const featureCondition = function(props) { - return props.features && props.features.indexOf( name ) != -1; + +const bitcoinExternal = function(props) { + return props.bitcoin_mode === 'external' +}; + +const bitcoinInternal = function(props) { + return props.bitcoin_mode === 'internal' }; module.exports = { @@ -8,12 +13,56 @@ module.exports = { return name; }, prompts: function( utils ) { - return [{ - when: featureCondition, + return [ + { + type: 'list', + name: 'bitcoin_mode', + default: utils._getDefault( 'bitcoin_mode' ), + message: 'Where is your bitcoin full node running?'+'\n', + choices: [ + { + name: 'Nowhere! I want cyphernode to run one.', + value: 'internal' + }, + { + name: 'I have a full node running.', + value: 'external' + } + ] + }, + { + when: bitcoinExternal, + type: 'input', + name: 'bitcoin_node_ip', + default: utils._getDefault( 'bitcoin_node_ip' ), + validate: utils._ipValidator, + message: 'What is your full node ip address?'+'\n', + }, + { + type: 'input', + name: 'bitcoin_rpcuser', + default: utils._getDefault( 'bitcoin_rpcuser' ), + message: 'Name of bitcoin rpc user?'+'\n', + }, + { + type: 'password', + name: 'bitcoin_rpcpassword', + default: utils._getDefault( 'bitcoin_rpcpassword' ), + message: 'Password of bitcoin rpc user?'+'\n', + }, + { + when: bitcoinInternal, type: 'confirm', name: 'bitcoin_prune', default: utils._getDefault( 'bitcoin_prune' ), message: 'Run bitcoin node in prune mode?'+'\n', + }, + { + when: bitcoinInternal, + type: 'confirm', + name: 'bitcoin_expose', + default: utils._getDefault( 'bitcoin_expose' ), + message: 'Expose bitcoin full node outside of the docker network?'+'\n', }]; }, env: function( props ) {