dk-compare-env v3.2.14
Comparison utility for .env files
In enterprise projects you often need to pass some environment params to your application. The good way is to create different files like
.env
example.dev.env
example.prod.env
and include them using dotenv
. It's also good to create env.ts
file that will parse this params
in accordance with expected types, filters some secret data and could be imported in application.
Current .env
should be always git-ignored so no sensitive data is leaked and every server or
developer could configure it as he likes.
But when you deal with different files with similar structure there is always way to make a mistake -
for example example.dev.env
was changed, so local .env
on other dev's machine becomes out-of-date,
which leads to application error.
Purpose of this lib
- compares different
.env
files and prints absent keys - compares
.env
keys with those inenv.ts
Usage
- Add
dk-compare-env
to package.json - Call before you start your build
const path = require('path');
import { compareEnvFiles } from 'dk-compare-env';
import { env } from './env';
compareEnvFiles({
paths: [
path.resolve(__dirname, '.env'),
path.resolve(__dirname, 'example.dev.env'),
path.resolve(__dirname, 'example.prod.env'),
],
parsedEnvKeys: Object.keys(env) // optional
});
where paths
are absolute paths and parsedEnvKeys
(optional) is array of strings.
28 days ago
28 days ago
28 days ago
28 days ago
28 days ago
28 days ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
9 months ago
7 months ago
9 months ago
7 months ago
7 months ago
10 months ago
10 months ago
10 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
7 months ago
6 months ago
6 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago