$ErrorActionPreference = 'Stop' $certificateDirectory = Join-Path $env:LOCALAPPDATA 'SovereignAI\certs' $env:SOVEREIGNAI_TLS_CERTFILE = Join-Path $certificateDirectory 'localhost-cert.pem' $env:SOVEREIGNAI_TLS_KEYFILE = Join-Path $certificateDirectory 'localhost-key.pem' if (-not (Test-Path -LiteralPath $env:SOVEREIGNAI_TLS_CERTFILE -PathType Leaf) -or -not (Test-Path -LiteralPath $env:SOVEREIGNAI_TLS_KEYFILE -PathType Leaf)) { throw 'Local TLS certificate is missing. First run .\scripts\setup_local_tls.ps1.' } if (-not $env:SOVEREIGNAI_API_PORT) { $env:SOVEREIGNAI_API_PORT = '8443' } Write-Host "Starting the optional HTTPS API on https://localhost:$env:SOVEREIGNAI_API_PORT" & (Join-Path $PSScriptRoot 'start-api.ps1')