36 lines
1.0 KiB
PowerShell
36 lines
1.0 KiB
PowerShell
param(
|
|
[string]$PfxPath = "$env:USERPROFILE\.aspnet\https\minattest-app.pfx",
|
|
[string]$PfxPass = "mypass",
|
|
[int]$BffHttpsPort = 7228,
|
|
[int]$Port = 5173
|
|
)
|
|
|
|
function Ensure-DevCertExported {
|
|
param([string]$Path, [string]$Pass)
|
|
if (-not (Test-Path -LiteralPath $Path)) {
|
|
Write-Host "Exporting .NET dev cert to: $Path" -ForegroundColor Cyan
|
|
dotnet dev-certs https -ep $Path -p $Pass | Out-Null
|
|
dotnet dev-certs https --trust | Out-Null
|
|
}
|
|
}
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
# Move to app root (one up from scripts folder)
|
|
Set-Location (Resolve-Path (Join-Path $PSScriptRoot '..'))
|
|
|
|
Ensure-DevCertExported -Path $PfxPath -Pass $PfxPass
|
|
|
|
$env:SSL_PFX_PATH = $PfxPath
|
|
$env:SSL_PFX_PASS = $PfxPass
|
|
$env:VITE_ASPNETCORE_HTTPS_PORT = "$BffHttpsPort"
|
|
|
|
Write-Host "Launching Vite over HTTPS:" -ForegroundColor Green
|
|
Write-Host " SSL_PFX_PATH = $PfxPath"
|
|
Write-Host " VITE_ASPNETCORE_HTTPS_PORT = $BffHttpsPort"
|
|
Write-Host " Port = $Port"
|
|
|
|
npm run dev -- --port $Port
|
|
|