JSPM

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

Like the popular `dotenv`, but zero-dependencies and less verbose.

Package Exports

  • envk

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

Like the popular dotenv, but zero-dependencies and less verbose.

This package is a slimmer and less "config verbose" alternative to the popular dotenv:

  • it looks either for the env NODE_ENV (thus loading .env.<NODE_ENV> file) or ENVK (thus loading <ENVK> file)
  • it parses the env file (single quotes, double quotes and comments supported)
  • it assign the variables parsed to the process.env global object

When both ENVK and NODE_ENV are specified, ENVK has priority. You can easily see what's happening into index.js: wysiwyg'est as possible.

Nothing more, nothing less.

Usage:

To load envs from .env.<NODE_ENV> file (i.e: .env.development)

NODE_ENV=development node -r envk index.js

To load envs from specific file (i.e: file.env):

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

To debug imported env variables:

NODE_ENV=development ENVK_DEBUG=1 node -r envk index.js
# or
ENVK=file.env ENVK_DEBUG=1 node -r envk index.js