diff --git a/src/node/entry.ts b/src/node/entry.ts index f13c847ec..33419243e 100644 --- a/src/node/entry.ts +++ b/src/node/entry.ts @@ -37,10 +37,13 @@ const main = async (args: Args): Promise => { port: typeof args.port !== "undefined" ? args.port : process.env.PORT !== "" ? process.env.PORT : 8080, socket: args.socket, } + if (!options.cert && args.cert) { const { cert, certKey } = await generateCertificate() options.cert = cert options.certKey = certKey + } else if (args.cert && !args["cert-key"]) { + throw new Error("--cert-key is missing") } const httpServer = new HttpServer(options) @@ -70,7 +73,7 @@ const main = async (args: Args): Promise => { if (httpServer.protocol === "https") { logger.info( typeof args.cert === "string" - ? ` - Using provided certificate${args["cert-key"] ? " and key" : ""} for HTTPS` + ? ` - Using provided certificate and key for HTTPS` : ` - Using generated certificate and key for HTTPS`, ) } else {