# Fetch the Caddy binary used by run.ps1. # # pwsh server/get-caddy.ps1 # # ~47 MB, gitignored. One self-contained exe -- nothing is installed and # nothing is added to PATH. $ErrorActionPreference = 'Stop' $here = Split-Path -Parent $MyInvocation.MyCommand.Path $dst = Join-Path $here 'caddy.exe' if (Test-Path $dst) { Write-Host "caddy.exe already present: $(& $dst version)" Write-Host "delete it first if you want to re-download." exit 0 } $arch = if ([Environment]::Is64BitOperatingSystem) { 'amd64' } else { '386' } $url = "https://caddyserver.com/api/download?os=windows&arch=$arch" Write-Host "downloading caddy ($arch)..." Invoke-WebRequest -Uri $url -OutFile $dst -UseBasicParsing -TimeoutSec 300 Write-Host ("done: {0:N1} MB" -f ((Get-Item $dst).Length / 1MB)) & $dst version