Autoload your environment variables from your `.env` file, no code changes required. Similar to `dotenv`, but with zero-dependencies and less verbose.
npm install envkThis packages lets you autoload your environment variables from your .env file, no code changes required.
Similar to dotenv, but with zero-dependencies and less verbose.
Easy as:
``sh`
yarn add envk
node -r envk index.js
Features:
- auto-detect of .env. or .env file.env
- support for custom filename with ENVK environment variable"SECRET=hello\nworld"
- support for variable expansion
- support for single quotes
- support for double quotes
- support for empty lines
- support for multiline quoting with double quotes #
- support for comments prefixing the line with
You can see what's happening inspecting index.js.
Nothing more, nothing less.
Load envs from .env:`sh`
node -r envk index.js
Load envs from .env.production file, otherwise .env:`sh`
NODE_ENV=production node -r envk index.js
Load envs from specific file:
`sh`
ENVK=file.env node -r envk index.js
Log to console imported variables:
`sh``
ENVK_DEBUG=1 node -r envk index.js