MCPcopy
hub / github.com/prisma/prisma / getBinaryEnvVarPath

Function getBinaryEnvVarPath

packages/fetch-engine/src/env.ts:24–46  ·  view source on GitHub ↗
(binaryName: BinaryType)

Source from the content-addressed store, hash-verified

22}
23
24export function getBinaryEnvVarPath(binaryName: BinaryType): PathFromEnvValue | null {
25 const envVar = getEnvVarToUse(binaryName)
26
27 if (process.env[envVar]) {
28 const envVarPath = path.resolve(process.cwd(), process.env[envVar]!)
29 if (!fs.existsSync(envVarPath)) {
30 throw new Error(
31 `Env var ${bold(envVar)} is provided but provided path ${underline(process.env[envVar]!)} can't be resolved.`,
32 )
33 }
34 debug(
35 `Using env var ${bold(envVar)} for binary ${bold(binaryName)}, which points to ${underline(
36 process.env[envVar]!,
37 )}`,
38 )
39 return {
40 path: envVarPath,
41 fromEnvVar: envVar,
42 }
43 }
44
45 return null
46}
47
48function getEnvVarToUse(binaryType: BinaryType): string {
49 const envVar = engineEnvVarMap[binaryType]

Callers 4

resolveBinaryFunction · 0.90
resolveEngineFunction · 0.90
downloadFunction · 0.90
allEngineEnvVarsSetFunction · 0.85

Calls 2

getEnvVarToUseFunction · 0.85
debugFunction · 0.85

Tested by

no test coverage detected