()
| 366 | // 4. Apply spend limits from config |
| 367 | if (cfg.spendLimits) { |
| 368 | const applyLimits = async () => { |
| 369 | await sleep(3000); |
| 370 | for (const [window, amount] of Object.entries(cfg.spendLimits)) { |
| 371 | if (typeof amount === "number" && amount > 0) { |
| 372 | await postJson(`http://127.0.0.1:${port}/v1/spend`, { action: "set", window, amount }); |
| 373 | } |
| 374 | } |
| 375 | api.logger.info("Spend limits applied from config"); |
| 376 | }; |
| 377 | applyLimits().catch(() => {}); |
| 378 | } |
| 379 |