MCPcopy
hub / github.com/promptfoo/promptfoo / getEnvBool

Function getEnvBool

src/envars.ts:489–498  ·  view source on GitHub ↗
(key: EnvVarKey, defaultValue?: boolean)

Source from the content-addressed store, hash-verified

487 * @returns The boolean value of the environment variable, or the default value if provided.
488 */
489export function getEnvBool(key: EnvVarKey, defaultValue?: boolean): boolean {
490 const value = getEnvString(key) || defaultValue;
491 if (typeof value === 'boolean') {
492 return value;
493 }
494 if (typeof value === 'string') {
495 return ['1', 'true', 'yes', 'yup', 'yeppers'].includes(value.toLowerCase());
496 }
497 return Boolean(defaultValue);
498}
499
500/**
501 * Get an integer environment variable.

Callers 15

fetch.test.tsFile · 0.90
envars.test.tsFile · 0.90
renderPromptFunction · 0.90
cache.tsFile · 0.90
initializeRunLoggingFunction · 0.90
attachConversationVarFunction · 0.90
isTracingEnabledForTestFunction · 0.90
evaluateMethod · 0.90
checkForUpdatesFunction · 0.90
checkModelAuditUpdatesFunction · 0.90
sendChunkedResultsFunction · 0.90

Calls 1

getEnvStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…