Skip to content

Commit

Permalink
feat(ssl): allow SSL email to be provided via option, skip prompts (#195
Browse files Browse the repository at this point in the history
)

refs #194
- If --sslemail is provided, use that instead of prompting
- Makes it easier to call ghost programmatically
  • Loading branch information
ErisDS authored and acburdine committed Jun 13, 2017
1 parent 201dbbf commit 8eef01e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/commands/config/advanced.js
Expand Up @@ -84,6 +84,10 @@ module.exports = [{
name: 'dbname',
description: 'Database name',
configPath: 'database.connection.database'
}, {
name: 'sslemail',
description: 'SSL email address',
configPath: 'ssl.email'
}, {
name: 'auth',
description: 'Type of authentication to use',
Expand Down
14 changes: 12 additions & 2 deletions lib/services/nginx/index.js
Expand Up @@ -73,10 +73,20 @@ class NginxService extends BaseService {
});
}

let answers;
let ghostExec = process.argv.slice(0,2).join(' ');
let answerPromise;
let answers;

if (this.config.get('ssl.email', false)) {
answerPromise = Promise.resolve({
ssl: true,
email: this.config.get('ssl.email')
});
} else {
answerPromise = this.ui.prompt(prompts);
}

return this.ui.prompt(prompts).then((_answers) => {
return answerPromise.then((_answers) => {
answers = _answers;

return this.ui.noSpin(execa.shell(`sudo ${ghostExec} service nginx-conf${!answers.ssl ? ' no-ssl' : ''}`, {stdio: 'inherit'})).catch((error) => {
Expand Down

0 comments on commit 8eef01e

Please sign in to comment.