Skip to content

Commit 8eef01e

Browse files
ErisDSacburdine
authored andcommitted
feat(ssl): allow SSL email to be provided via option, skip prompts (#195)
refs #194 - If --sslemail is provided, use that instead of prompting - Makes it easier to call ghost programmatically
1 parent 201dbbf commit 8eef01e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

lib/commands/config/advanced.js

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ module.exports = [{
8484
name: 'dbname',
8585
description: 'Database name',
8686
configPath: 'database.connection.database'
87+
}, {
88+
name: 'sslemail',
89+
description: 'SSL email address',
90+
configPath: 'ssl.email'
8791
}, {
8892
name: 'auth',
8993
description: 'Type of authentication to use',

lib/services/nginx/index.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,20 @@ class NginxService extends BaseService {
7373
});
7474
}
7575

76-
let answers;
7776
let ghostExec = process.argv.slice(0,2).join(' ');
77+
let answerPromise;
78+
let answers;
79+
80+
if (this.config.get('ssl.email', false)) {
81+
answerPromise = Promise.resolve({
82+
ssl: true,
83+
email: this.config.get('ssl.email')
84+
});
85+
} else {
86+
answerPromise = this.ui.prompt(prompts);
87+
}
7888

79-
return this.ui.prompt(prompts).then((_answers) => {
89+
return answerPromise.then((_answers) => {
8090
answers = _answers;
8191

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

0 commit comments

Comments
 (0)