made lightning node alias and color optional. added lightning node name generator for nice default aliases

This commit is contained in:
jash
2018-12-19 15:40:04 +01:00
committed by kexkey
parent 08a683266e
commit ff1f226f8e
4 changed files with 2398 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ const fs = require('fs');
const validator = require('validator');
const path = require("path");
const coinstring = require('coinstring');
const name = require('./lib/name.js');
const Archive = require('./lib/archive.js');
const ApiKey = require('./lib/apikey.js');
const Cert = require('./lib/cert.js');
@@ -16,8 +17,7 @@ const userRegexp = /^[a-zA-Z0-9\._\-]+$/;
const reset = '\u001B8\u001B[u';
const clear = '\u001Bc';
const configFileVersion='0.0.1';
const configFileVersion='0.1.0';
const defaultAPIProperties = `
# Watcher can:
@@ -302,7 +302,6 @@ module.exports = class extends Generator {
}
}
delete this.props.gatekeeper_recreatekeys;
}
@@ -385,7 +384,7 @@ module.exports = class extends Generator {
proxy_datapath: '',
lightning_implementation: 'c-lightning',
lightning_datapath: '',
lightning_nodename: '',
lightning_nodename: name.generate(),
lightning_nodecolor: '',
otsclient_datapath: '',
installer_cleanup: false
@@ -442,6 +441,13 @@ module.exports = class extends Generator {
return true;
}
_lightningNodeNameValidator(name) {
if( !name || name.length > 32 ) {
throw new Error('Please enter anything shorter than 32 characters');
}
return true;
}
_notEmptyValidator( path ) {
if( !path ) {
throw new Error('Please enter something');

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@ const templates = {
};
module.exports = {
name: function() {
name: function() {
return name;
},
prompts: function( utils ) {
@@ -42,7 +42,7 @@ module.exports = {
name: 'LND',
value: 'lnd'
}
]
},
*/
@@ -61,7 +61,12 @@ module.exports = {
name: 'lightning_nodename',
default: utils._getDefault( 'lightning_nodename' ),
filter: utils._trimFilter,
validate: utils._notEmptyValidator,
validate: (input)=>{
if( !input.trim() ) {
return true;
}
return utils._lightningNodeNameValidator(input);
},
message: prefix()+'What name has your lightning node?'+utils._getHelp('lightning_nodename'),
},
{
@@ -70,7 +75,12 @@ module.exports = {
name: 'lightning_nodecolor',
default: utils._getDefault( 'lightning_nodecolor' ),
filter: utils._trimFilter,
validate: utils._colorValidator,
validate: (input)=>{
if( !input.trim() ) {
return true;
}
return utils._colorValidator(input);
},
message: prefix()+'What color has your lightning node?'+utils._getHelp('lightning_nodecolor'),
}];
},

View File

@@ -4,8 +4,12 @@ network=testnet
<% } else if (net === 'mainnet') { %>
network=bitcoin
<% } %>
<% if( lightning_nodename ) { %>
alias=<%= lightning_nodename %>
<% } %>
<% if( lightning_nodecolor ) { %>
rgb=<%= lightning_nodecolor %>
<% } %>
bitcoin-rpcconnect=<%= (bitcoin_mode === 'internal')?'bitcoin':bitcoin_node_ip %>
bitcoin-rpcuser=<%= bitcoin_rpcuser %>
bitcoin-rpcpassword=<%= bitcoin_rpcpassword %>