Files
memind/health-baseline-worker-config.mjs
T
john 2baf29b3ae feat(health): complete P0 health channel — baseline engine, page-data, MindSpace UI
Deliver encrypted health zone, observation API, baseline maturity pipeline,
page-data bindings, and H5/WeChat channel integration for health P0.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 18:04:57 +08:00

26 lines
1023 B
JavaScript

/**
* Health baseline / event job worker enablement.
* Default off; enable with MEMIND_HEALTH_BASELINE_JOB_ENABLED=1 when health is on.
*/
export function isHealthBaselineJobEnabled(env = process.env) {
if (!/^(1|true|yes)$/i.test(String(env?.MEMIND_HEALTH_ENABLED ?? '').trim())) {
return false;
}
const explicit = String(env.MEMIND_HEALTH_BASELINE_JOB_ENABLED ?? '').trim();
if (explicit === '1' || explicit === 'true') return true;
if (explicit === '0' || explicit === 'false') return false;
return env.H5_REMINDER_WORKER_ENABLED === '1';
}
export function healthBaselineJobIntervalMs(env = process.env) {
const raw = Number(env.MEMIND_HEALTH_BASELINE_JOB_INTERVAL_MS ?? 60 * 60 * 1000);
if (!Number.isFinite(raw) || raw < 60_000) return 60 * 60 * 1000;
return raw;
}
export function healthBaselineJobUserBatchLimit(env = process.env) {
const raw = Number(env.MEMIND_HEALTH_BASELINE_JOB_USER_LIMIT ?? 500);
if (!Number.isFinite(raw) || raw < 1) return 500;
return Math.min(raw, 2000);
}