Files
calendar-scheduling-OPEN/scripts/send-authorized-postmark-test.ps1
T

21 lines
1016 B
PowerShell
Raw Permalink Normal View History

2026-10-06 14:47:01 -06:00
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][switch]$ConfirmExternalSend
)
$ErrorActionPreference = "Stop"
foreach ($name in @('POSTMARK_SERVER_TOKEN','SCHEDULING_TEST_DATABASE','SCHEDULING_TEST_SENDER','SCHEDULING_TEST_RECIPIENT')) {
if ([string]::IsNullOrWhiteSpace([Environment]::GetEnvironmentVariable($name))) { throw "Required environment configuration is missing: $name" }
}
$projectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
$pythonCommand = Get-Command python -ErrorAction SilentlyContinue
if (-not $pythonCommand) { throw "Python 3.11 or newer must be available on PATH." }
$prior = $env:SCHEDULING_AUTHORIZED_POSTMARK_TEST
try {
$env:SCHEDULING_AUTHORIZED_POSTMARK_TEST = "1"
$env:PYTHONPATH = Join-Path $projectRoot "src"
& $pythonCommand.Source (Join-Path $PSScriptRoot "send_authorized_postmark_test.py")
exit $LASTEXITCODE
} finally {
$env:SCHEDULING_AUTHORIZED_POSTMARK_TEST = $prior
Remove-Item Env:\PYTHONPATH -ErrorAction SilentlyContinue
}