JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 946
  • Score
    100M100P100Q93459F
  • License MIT

Autoload your environment variables from your `.env` file, no code changes required. Similar to `dotenv`, but with zero-dependencies and less verbose.

Package Exports

  • envk
  • envk/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (envk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

envk

This 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:

yarn add envk
node -r envk index.js # autoloads .env file

Features:

  • auto-detect of .env.<NODE_ENV> or .env file
  • support for custom .env filename with ENVK environment variable
  • support for single quotes, double quotes, empty lines and comments

You can easily see what's happening inspecting index.js: wysiwyg'est at maximum level.

Nothing more, nothing less.

Usage

Load envs from .env:

node -r envk index.js

Load envs from .env.production file, otherwise .env:

NODE_ENV=production node -r envk index.js

Load envs from specific file:

ENVK=file.env node -r envk index.js

Log to console imported variables:

ENVK_DEBUG=1 node -r envk index.js