fix:优化服务
This commit is contained in:
20
video_worker/scripts/run_ws_service.ps1
Normal file
20
video_worker/scripts/run_ws_service.ps1
Normal file
@@ -0,0 +1,20 @@
|
||||
$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
|
||||
Reference in New Issue
Block a user