MCPcopy
hub / github.com/promptfoo/promptfoo / getEnvInt

Function getEnvInt

src/envars.ts:508–518  ·  view source on GitHub ↗
(key: EnvVarKey, defaultValue?: number)

Source from the content-addressed store, hash-verified

506export function getEnvInt(key: EnvVarKey): number | undefined;
507export function getEnvInt(key: EnvVarKey, defaultValue: number): number;
508export function getEnvInt(key: EnvVarKey, defaultValue?: number): number | undefined {
509 const str = getEnvString(key);
510 if (str === undefined || str === '') {
511 return defaultValue;
512 }
513 const parsedValue = Number.parseInt(str, 10);
514 if (!Number.isNaN(parsedValue)) {
515 return parsedValue;
516 }
517 return defaultValue;
518}
519
520/**
521 * Get a float environment variable.

Callers 15

envars.test.tsFile · 0.90
getCacheTtlMsFunction · 0.90
getDefaultPortFunction · 0.90
runEvalInternalFunction · 0.90
sendChunkedResultsFunction · 0.90
constructorMethod · 0.90
index.tsFile · 0.90
loadTraceDataFunction · 0.90
handleWebhookFunction · 0.90
getRequestTimeoutMsFunction · 0.90
callApiInternalMethod · 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…