Archived
1
0

Properly fix blank --cert flag

See #1109.
This commit is contained in:
Asher
2019-10-25 11:53:20 -05:00
parent b8e6369fbe
commit 58f7f5b769
2 changed files with 15 additions and 3 deletions

View File

@ -101,8 +101,11 @@ const startVscode = async (): Promise<void | void[]> => {
options.password = await generatePassword();
}
// This is necessary since VS Code filters out empty strings.
if (typeof options.cert === "undefined" && process.argv.indexOf("--cert") !== -1) {
if (!options.certKey && typeof options.certKey !== "undefined") {
throw new Error(`--cert-key cannot be blank`);
} else if (options.certKey && !options.cert) {
throw new Error(`--cert-key was provided but --cert was not`);
} if (!options.cert && typeof options.cert !== "undefined") {
const { cert, certKey } = await generateCertificate();
options.cert = cert;
options.certKey = certKey;