envk

3.4.1 • Public • Published

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

Features:

  • auto-detect of .env.<NODE_ENV> or .env file
  • support for custom .env filename with ENVK environment variable
  • support for variable expansion
  • support for single quotes
  • support for double quotes
  • support for empty lines
  • support for multiline quoting with double quotes "SECRET=hello\nworld"
  • support for comments prefixing the line with #

You can see what's happening inspecting index.js.

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

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i envk

    Weekly Downloads

    301

    Version

    3.4.1

    License

    MIT

    Unpacked Size

    6.73 kB

    Total Files

    13

    Last publish

    Collaborators

    • damianobarbati