(account, headers, hostname, zoneId)
| 306 | } |
| 307 | |
| 308 | async function attachWorkerDomain(account, headers, hostname, zoneId) { |
| 309 | const { ok, json } = await cf( |
| 310 | `${CF_API}/accounts/${account}/workers/domains`, |
| 311 | headers, |
| 312 | { |
| 313 | method: "PUT", |
| 314 | body: JSON.stringify({ |
| 315 | hostname, |
| 316 | service: PROXY_WORKER, |
| 317 | environment: "production", |
| 318 | override_existing_origin: true, |
| 319 | zone_id: zoneId, |
| 320 | }), |
| 321 | }, |
| 322 | ); |
| 323 | |
| 324 | if (!ok) { |
| 325 | throw new Error( |
| 326 | `Attach proxy domain ${hostname} failed: ${JSON.stringify(json)}`, |
| 327 | ); |
| 328 | } |
| 329 | |
| 330 | console.log(`Proxy custom domain ready: ${hostname} -> ${PROXY_WORKER}`); |
| 331 | } |
| 332 | |
| 333 | function appContext(appName) { |
| 334 | const config = JSON.parse( |
no test coverage detected