mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-26 00:55:08 +01:00
hosts in validator can now be ip address or fully qualified domain names
This commit is contained in:
@@ -35,7 +35,7 @@ module.exports = {
|
||||
type: 'input',
|
||||
name: 'bitcoin_node_ip',
|
||||
default: utils._getDefault( 'bitcoin_node_ip' ),
|
||||
validate: utils._ipValidator,
|
||||
validate: utils._ipOrFQDNValidator,
|
||||
message: 'What is your full node ip address?'+'\n',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ module.exports = {
|
||||
type: 'input',
|
||||
name: 'lightning_external_ip',
|
||||
default: utils._getDefault( 'lightning_external_ip' ),
|
||||
validate: utils._ipValidator,
|
||||
validate: utils._ipOrFQDNValidator,
|
||||
message: 'What external ip does your lightning node have?'+'\n',
|
||||
}];
|
||||
},
|
||||
|
||||
@@ -73,8 +73,15 @@ module.exports = class extends Generator {
|
||||
return this.props && this.props[name];
|
||||
}
|
||||
|
||||
_ipValidator( ip ) {
|
||||
return validator.isIP((ip+"").trim());
|
||||
_ipOrFQDNValidator( host ) {
|
||||
host = (host+"").trim();
|
||||
|
||||
if( !(validator.isIP(host) ||
|
||||
validator.isFQDN(host)) ) {
|
||||
throw new Error( 'No IP address or fully qualified domain name' )
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_xkeyValidator( xpub ) {
|
||||
|
||||
Reference in New Issue
Block a user