Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/sunny-eyes-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'dotenv-diff': patch
---

added more default exclude keys
10 changes: 10 additions & 0 deletions docs/configuration_and_flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ Specify a comma-separated list of keys to ignore during the comparison other tha
- `CI`
- `GITHUB_ACTIONS`
- `INIT_CWD`
- `PORT`
- `PATH`
- `HOME`
- `USER`
- `SHELL`
- `LANG`
- `TMP`
- `TEMP`
- `TMPDIR`
- `NODE_PATH`

This is useful when you have certain environment variables that are expected to differ between environments and you want to exclude them from the comparison.

Expand Down
10 changes: 10 additions & 0 deletions packages/cli/src/core/filterIgnoredKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ export const DEFAULT_EXCLUDE_KEYS = [
'GITHUB_ACTIONS',
'INIT_CWD',
'TZ',
'PORT',
'PATH',
'HOME',
'USER',
'SHELL',
'LANG',
'TMP',
'TEMP',
'TMPDIR',
'NODE_PATH',
];

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/test/unit/core/compare/parseAndFilterEnv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ BAZ=
it('handles special characters in values', () => {
fs.writeFileSync(
envPath,
'URL=https://example.com?foo=bar&baz=qux\nPATH=/usr/local/bin\n',
'URL=https://example.com?foo=bar&baz=qux\nDB_PATH=/usr/local/bin\n',
);
fs.writeFileSync(examplePath, 'URL=\nPATH=\n');
fs.writeFileSync(examplePath, 'URL=\nDB_PATH=\n');

const opts: ComparisonOptions = {
checkValues: false,
Expand All @@ -237,7 +237,7 @@ BAZ=
const result = parseAndFilterEnv(envPath, examplePath, opts);

expect(result.current.URL).toContain('https://');
expect(result.current.PATH).toBe('/usr/local/bin');
expect(result.current.DB_PATH).toBe('/usr/local/bin');
});

it('handles keys with dots and hyphens', () => {
Expand Down