fixed recreation of keys and certs

This commit is contained in:
jash
2018-11-03 12:27:55 +01:00
committed by kexkey
parent 653c69f5bf
commit 516b80ebd7
2 changed files with 15 additions and 15 deletions

View File

@@ -316,19 +316,6 @@ module.exports = class extends Generator {
/* some utils */
_hasAuthKeys() {
return this.props &&
this.props.gatekeeper_keys &&
this.props.gatekeeper_keys.configEntries &&
this.props.gatekeeper_keys.configEntries.length > 0;
}
_hasCert() {
return this.props &&
this.props.gatekeeper_sslkey &&
this.props.gatekeeper_sslcert
}
_assignConfigDefaults() {
this.props = Object.assign( {
features: [],

View File

@@ -10,6 +10,19 @@ const prefix = function() {
return chalk.bold.red(capitalise(name)+': ');
};
const hasAuthKeys = function( props ) {
return props &&
props.gatekeeper_keys &&
props.gatekeeper_keys.configEntries &&
props.gatekeeper_keys.configEntries.length > 0;
}
const hasCert = function( props ) {
return props &&
props.gatekeeper_sslkey &&
props.gatekeeper_sslcert
}
module.exports = {
name: function() {
return name;
@@ -25,14 +38,14 @@ module.exports = {
validate: utils._notEmptyValidator
},
{
when: utils._hasAuthKeys,
when: function() { return hasAuthKeys( utils.props ); },
type: 'confirm',
name: 'gatekeeper_recreatekeys',
default: false,
message: prefix()+'Recreate gatekeeper keys?'+utils._getHelp('gatekeeper_recreatekeys')
},
{
when: utils._hasCert,
when: function() { return hasCert( utils.props ); },
type: 'confirm',
name: 'gatekeeper_recreatecert',
default: false,