MCPcopy
hub / github.com/triggerdotdev/trigger.dev / getEnvFilename

Function getEnvFilename

packages/cli/src/utils/env.ts:7–27  ·  view source on GitHub ↗
(
  directory: string,
  possibleNames: string[]
)

Source from the content-addressed store, hash-verified

5import { renderApiKey } from "./renderApiKey";
6
7export async function getEnvFilename(
8 directory: string,
9 possibleNames: string[]
10): Promise<string | undefined> {
11 if (possibleNames.length === 0) {
12 throw new Error("No possible names provided");
13 }
14
15 for (let index = 0; index < possibleNames.length; index++) {
16 const name = possibleNames[index];
17 if (!name) continue;
18
19 const path = pathModule.join(directory, name);
20 const envFileExists = await pathExists(path);
21 if (envFileExists) {
22 return name;
23 }
24 }
25
26 return undefined;
27}
28
29export async function setApiKeyEnvironmentVariable(dir: string, fileName: string, apiKey: string) {
30 await setEnvironmentVariable(dir, fileName, "TRIGGER_API_KEY", apiKey, true, renderApiKey);

Callers 2

initCommandFunction · 0.90
resolveOptionsFunction · 0.90

Calls 1

pathExistsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…