Files
AI_A4000/video_worker/scripts/run_server.ps1
2026-04-07 00:37:39 +08:00

21 lines
784 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 scripts/install_windows_env.ps1 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:APP_HOST) { $env:APP_HOST } else { "0.0.0.0" }
$portValue = if ($env:APP_PORT) { $env:APP_PORT } else { "8000" }
python -m uvicorn app.main:app --host $hostValue --port $portValue