From 0fc83be54b4b891a7fcf39c815702f7065887aa8 Mon Sep 17 00:00:00 2001 From: William Weiss Date: Mon, 19 Feb 2024 09:14:20 -0500 Subject: [PATCH] startServer onListen logs https when key & cert specified (#2321) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some team members of mine were confused by the default output ``` 🍋 Fresh ready Local: http://localhost:8000/ ``` when the server is actually running HTTPS. This should now print ``` 🍋 Fresh ready Local: https://localhost:8000/ ``` when a key and cert are specified. --- src/server/boot.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/boot.ts b/src/server/boot.ts index c94af6c9..7b2b84f9 100644 --- a/src/server/boot.ts +++ b/src/server/boot.ts @@ -9,8 +9,10 @@ export async function startServer( if (!opts.onListen) { opts.onListen = (params) => { const pathname = opts.basePath + "/"; + const https = !!(opts.key && opts.cert); + const protocol = https ? "https:" : "http:"; const address = colors.cyan( - `http://localhost:${params.port}${pathname}`, + `${protocol}//localhost:${params.port}${pathname}`, ); const localLabel = colors.bold("Local:");