diff --git a/lib/commands/config/advanced.js b/lib/commands/config/advanced.js index aa2cd87ca..7d0d97ea2 100644 --- a/lib/commands/config/advanced.js +++ b/lib/commands/config/advanced.js @@ -83,6 +83,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', diff --git a/lib/services/nginx/index.js b/lib/services/nginx/index.js index 0058f4e34..a8c15b231 100644 --- a/lib/services/nginx/index.js +++ b/lib/services/nginx/index.js @@ -72,10 +72,20 @@ class NginxService extends BaseService { }); } - let answers; let ghostExec = process.argv.slice(0,2).join(' '); + let answerPromise; + let answers; + + if (this.config.values.ssl && this.config.values.ssl.email) { + answerPromise = Promise.resolve({ + ssl: true, + email: this.config.values.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) => { @@ -163,7 +173,6 @@ class NginxService extends BaseService { // add listen directives https._add('listen', '443 ssl http2'); https._add('listen', '[::]:443 ssl http2'); - https._add('server_name', this.parsedUrl.hostname); // add ssl cert directives https._add('ssl_certificate', `/etc/letsencrypt/live/${this.parsedUrl.hostname}/fullchain.pem`); https._add('ssl_certificate_key', `/etc/letsencrypt/live/${this.parsedUrl.hostname}/privkey.pem`);