Files
openclaw/scripts/e2e/lib/codex-media-path/limits.mjs
2026-06-05 00:04:03 -04:00

13 lines
412 B
JavaScript

// Limits shared by Codex media-path E2E fixtures.
export function readPositiveIntEnv(name, fallback, env = process.env) {
const text = String(env[name] ?? fallback).trim();
if (!/^\d+$/u.test(text)) {
throw new Error(`invalid ${name}: ${text}`);
}
const value = Number(text);
if (!Number.isSafeInteger(value) || value <= 0) {
throw new Error(`invalid ${name}: ${text}`);
}
return value;
}