made uacomment optional

This commit is contained in:
jash
2018-10-15 19:21:32 +02:00
committed by kexkey
parent 95ada5e4fc
commit 178558973b
2 changed files with 10 additions and 1 deletions

View File

@@ -139,6 +139,15 @@ module.exports = class extends Generator {
return this.props && this.props[name];
}
_optional(input,validator) {
if( input === undefined ||
input === null ||
input === '' ) {
return true;
}
return validator(input);
}
_ipOrFQDNValidator( host ) {
host = (host+"").trim();
if( !(validator.isIP(host) ||

View File

@@ -77,7 +77,7 @@ module.exports = {
default: utils._getDefault( 'bitcoin_uacomment' ),
message: prefix()+'Any UA comment?'+'\n',
filter: utils._trimFilter,
validate: utils._UACommentValidator
validate: (input)=> {return utils._optional(input,utils._UACommentValidator) }
}];
},
env: function( props ) {