21 lines
801 B
PowerShell
21 lines
801 B
PowerShell
$ErrorActionPreference = "Stop"
|
|
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
|
Set-Location $Root
|
|
|
|
if (!(Test-Path .venv)) { throw ".venv not found, run install script first" }
|
|
if (!(Test-Path .env)) { throw ".env not found, copy from .env.example" }
|
|
|
|
.\.venv\Scripts\Activate.ps1
|
|
Get-Content .env | ForEach-Object {
|
|
if ($_ -match "^\s*#") { return }
|
|
if ($_ -match "^\s*$") { return }
|
|
$parts = $_ -split "=", 2
|
|
if ($parts.Length -eq 2) {
|
|
[System.Environment]::SetEnvironmentVariable($parts[0], $parts[1], "Process")
|
|
}
|
|
}
|
|
|
|
$hostValue = if ($env:WS_GATEWAY_HOST) { $env:WS_GATEWAY_HOST } else { "0.0.0.0" }
|
|
$portValue = if ($env:WS_GATEWAY_PORT) { $env:WS_GATEWAY_PORT } else { "8010" }
|
|
python -m uvicorn app.ws_service:app --host $hostValue --port $portValue
|