Add command line flag for enabling production cert

This commit is contained in:
Max Goodman
2020-06-21 02:10:23 -07:00
parent b191079bf2
commit a1e3f100c7
4 changed files with 8 additions and 50 deletions

View File

@@ -41,6 +41,9 @@ async function main() {
.option('cert-dir', {
describe: 'Private directory to store SSL certificate in',
})
.option('cert-production', {
describe: 'Obtain a real SSL certificate using production servers',
})
.option('email', {
describe: 'Email for owner of SSL certificate',
})
@@ -105,6 +108,7 @@ async function main() {
if (argv.webserver) {
;({ broadcastState } = await initWebServer({
certDir: argv.certDir,
certProduction: argv.certProduction,
email: argv.email,
url: argv.webserver,
hostname: argv.hostname,

View File

@@ -79,6 +79,7 @@ function initApp({ username, password, baseURL, getInitialState, onMessage }) {
export default async function initWebServer({
certDir,
certProduction,
email,
url: baseURL,
hostname: overrideHostname,
@@ -110,7 +111,7 @@ export default async function initWebServer({
dataDir: certDir,
commonName: hostname,
email,
production: process.env.NODE_DEV === 'production',
production: certProduction,
serverHost: overrideHostname || hostname,
})
server = https.createServer({ key, cert }, app.callback())