mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-25 16:44:49 +01:00
made lightning node alias and color optional. added lightning node name generator for nice default aliases
This commit is contained in:
@@ -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');
|
||||
|
||||
2370
install/generator-cyphernode/generators/app/lib/name.js
Normal file
2370
install/generator-cyphernode/generators/app/lib/name.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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'),
|
||||
}];
|
||||
},
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
Reference in New Issue
Block a user