Skip to content

Commit f8e071d

Browse files
committed
fixup
1 parent 7b7ace1 commit f8e071d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ same major line. Should you need to upgrade to a new major, use an explicit
306306

307307
- `COREPACK_ENV_FILE` can be set to `0` to request Corepack to not attempt to
308308
load `.corepack.env`; it can be set to a path to specify a different env file.
309+
Only keys that starts with `COREPACK_` will be taken into account.
309310
For Node.js 18.x users, this setting has no effect as that version doesn't
310311
support parsing of `.env` files.
311312

sources/specUtils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ export async function loadSpec(initialCwd: string): Promise<LoadSpecResult> {
192192
} else {
193193
debugUtils.log(`Checking ${envFilePath}`);
194194
try {
195-
localEnv = {...parseEnv(await fs.promises.readFile(envFilePath, `utf8`)), ...process.env};
195+
localEnv = {
196+
...Object.fromEntries(Object.entries(parseEnv(await fs.promises.readFile(envFilePath, `utf8`))).filter(e => e[0].startsWith(`COREPACK_`))),
197+
...process.env,
198+
};
196199
debugUtils.log(`Successfully loaded env file found at ${envFilePath}`);
197200
} catch (err) {
198201
if ((err as NodeError)?.code !== `ENOENT`)

0 commit comments

Comments
 (0)