Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions 15 packages/cli-v3/src/utilities/dotEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ export function resolveDotEnvVars(cwd?: string, envFile?: string) {
? resolve(cwd ?? process.cwd(), envFile)
: ENVVAR_FILES.map((p) => resolve(cwd ?? process.cwd(), p));

dotenv.config({
processEnv: result,
path: envFilePath,
// Load environment variables from the first found .env file
const { parsed } = dotenv.config({
path: Array.isArray(envFilePath) ? envFilePath.find(path => fs.existsSync(path)) : envFilePath,
});

if (parsed) {
Object.assign(result, parsed);
}

env.TRIGGER_API_URL && (result.TRIGGER_API_URL = env.TRIGGER_API_URL);

// remove TRIGGER_API_URL and TRIGGER_SECRET_KEY, since those should be coming from the worker
// Remove sensitive environment variables
delete result.TRIGGER_API_URL;
delete result.TRIGGER_SECRET_KEY;
delete result.OTEL_EXPORTER_OTLP_ENDPOINT;
Expand All @@ -31,7 +35,8 @@ export function loadDotEnvVars(cwd?: string, envFile?: string) {
? resolve(cwd ?? process.cwd(), envFile)
: ENVVAR_FILES.map((p) => resolve(cwd ?? process.cwd(), p));

// Load the first found .env file
dotenv.config({
path: envFilePath,
path: Array.isArray(envFilePath) ? envFilePath.find(path => fs.existsSync(path)) : envFilePath,
});
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.