(url, timeoutMs = 60_000)
| 32 | (val.startsWith('"') && val.endsWith('"')) || |
| 33 | (val.startsWith("'") && val.endsWith("'")) |
| 34 | ) { |
| 35 | val = val.slice(1, -1); |
| 36 | } |
| 37 | |
| 38 | out[key] = val; |
| 39 | } |
| 40 | return out; |
| 41 | } |
| 42 | |
| 43 | function waitForUrl(url, timeoutMs = 60_000) { |
| 44 | const start = Date.now(); |
| 45 | return new Promise((resolve) => { |
| 46 | const check = async () => { |
| 47 | try { |
| 48 | const res = await fetch(url, { signal: AbortSignal.timeout(2000) }); |
| 49 | if (res.ok || res.status === 307) { |
| 50 | return resolve(true); |
| 51 | } |
| 52 | } catch { |