$ErrorActionPreference = 'Stop' $envFile = Join-Path $PSScriptRoot '..\.env' if (!(Test-Path $envFile)) { Write-Host '.env not found. Copy .env.example to .env first.' -ForegroundColor Yellow exit 1 } Get-Content $envFile | ForEach-Object { if ($_ -match '^\s*#' -or $_ -notmatch '=') { return } $name, $value = $_ -split '=', 2 [Environment]::SetEnvironmentVariable($name.Trim(), $value.Trim(), 'Process') } if ($env:MEDIASOUP_LISTEN_IP -in @('0.0.0.0', '::') -and !$env:MEDIASOUP_ANNOUNCED_ADDRESS) { Write-Host 'MEDIASOUP_ANNOUNCED_ADDRESS is required when MEDIASOUP_LISTEN_IP is 0.0.0.0 or ::' -ForegroundColor Red exit 1 } Write-Host 'Environment looks OK.' -ForegroundColor Green