From a3224cc1d2712cd261a739d3fb074464684c9342 Mon Sep 17 00:00:00 2001 From: Darren Reid Date: Fri, 8 Nov 2024 14:57:31 +1100 Subject: [PATCH] Update vite.config.ts --- MyApp.Client/vite.config.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MyApp.Client/vite.config.ts b/MyApp.Client/vite.config.ts index 93d8e34..4f0d25b 100644 --- a/MyApp.Client/vite.config.ts +++ b/MyApp.Client/vite.config.ts @@ -20,6 +20,13 @@ const baseFolder = ? `${env.APPDATA}/ASP.NET/https` : `${env.HOME}/.aspnet/https`; +const certificateArg = process.argv.map(arg => arg.match(/--name=(?.+)/i)).filter(Boolean)[0]; +const certificateName = certificateArg ? certificateArg!.groups!.value : "myapp.client"; +if (!certificateName) { + console.error('Invalid certificate name. Run this script in the context of an npm/yarn script or pass --name=<> explicitly.') + process.exit(-1); +} + const certFilePath = path.join(baseFolder, `${certificateName}.pem`); const keyFilePath = path.join(baseFolder, `${certificateName}.key`);