Skip to content

An opinionated but small environment variable reader for Javascript.

License

Notifications You must be signed in to change notification settings

shrimplejs/env

Repository files navigation

shrimple-env

An opinionated but small environment variable reader for Javascript.

Installation

Install shrimple-env with your package manager of choice. Bun should also work.

Usage

ES6/"headless"

import 'shrimple-env/init';

console.log(process.env.MY_ENV_VAR);

With this approach, shrimple-env will look for a .env file in the root of your project.

Configuration

import { init } from 'shrimple-env';
init({
    envFiles: ['.env', '.env.local'],
})

Additional tool(s)

Parser is also exported

The parsing tool used is also exported for better bug reproduction or for whatever reason you might need it.

import { parseEnv } from 'shrimple-env';

const env = 'HELLO=world\nFOO=bar';
const parsed = parseEnv(env);
console.log(parsed);

About

An opinionated but small environment variable reader for Javascript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published