Files
secret/script/vault-start.ps1
maze e3752ce910
Some checks failed
Test / tests (darwin-amd64) (push) Successful in 21s
Test / tests (linux-amd64) (push) Successful in 26s
Run Gosec / tests (push) Successful in 51s
Test / tests (linux-arm64) (push) Successful in 3m3s
Test / tests (windows-amd64) (push) Failing after 6m24s
Simplify Vault start on Windows
2025-09-09 16:29:58 +02:00

31 lines
856 B
PowerShell
Executable File

Write-Host "Starting Vault dev server..."
$vaultProc = Start-Process vault `
-ArgumentList "server -dev -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."