Files
secret/script/vault-start.ps1
maze f973e305f0
Some checks failed
Test / tests (windows-amd64) (push) Failing after 28s
Test / tests (linux-amd64) (push) Successful in 27s
Run Gosec / tests (push) Successful in 51s
Test / tests (linux-arm64) (push) Has been cancelled
Test / tests (darwin-amd64) (push) Successful in 20s
Moar bugs squashed
2025-09-09 16:43:52 +02:00

31 lines
915 B
PowerShell
Executable File

Write-Host "Starting Vault dev server..."
$vaultProc = Start-Process vault `
-ArgumentList "server -dev -dev-root-token-id=root -dev-listen-address=127.0.0.1:8200 -dev-tls" `
-RedirectStandardOutput "vault.out.log" `
-RedirectStandardError "vault.err.log" `
-WindowStyle Hidden `
-PassThru
$vaultPid = $vaultProc.Id
Write-Host "Vault started with PID $vaultPid"
Set-Content -Path vault.pid -Value $vaultPid
# Wait a moment for the job to start
Start-Sleep -Seconds 2
# Wait until Vault is ready
$maxRetries = 15
$ok = $false
for ($i=0; $i -lt $maxRetries; $i++) {
try {
Invoke-RestMethod -UseBasicParsing -SkipCertificateCheck https://127.0.0.1:8200/v1/sys/health | Out-Null
$ok = $true
break
} catch {
Start-Sleep -Seconds 2
}
}
if (-not $ok) {
Write-Error "Vault did not become ready in time"
Exit 1
}
Write-Host "Vault is up and running."