@kindpanda/env-loader

1.0.1 • Public • Published

env-loader

Simple util to override environment variables from .env files.

Examples

import loadEnv from '@kindpanda/env-loader';

loadEnv('./my-envs-path', 'test');

Will override process.env variables in a row with dotenv files:

  • ./my-envs-path/.env
  • ./my-envs-path/env.test
  • ./my-envs-path/env.test.local

It provide a helper class Environment to get env value with optional prefix.

import { Environment } from '@kindpanda/env-loader';

const env = new Environment({ prefix: 'MY_NAMESPACE_' });

const myVar = env.get('MY_VAR', 'default value');

Dependencies (1)

Dev Dependencies (15)

Package Sidebar

Install

npm i @kindpanda/env-loader

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

16.1 kB

Total Files

15

Last publish

Collaborators

  • tilap