@mullerstd/load-env

0.0.3 • Public • Published

@mullerstd/load-env

The easiest way to load .env files in your project

Install

yarn add @mullerstd/load-env

OR

npm install @mullerstd/load-env

Usage

Create a .env file in the project's root directory.

DATABASE_URL="postgresql://user:secret@localhost:5432/db"

You can load variables in two ways:

Use CLI wrapper

npx load-env node seed.js

or package.json script

{
  "scripts": {
    "start": "load-env node start.js"
  }
}

Load env's programmatically

import { loadEnv } from '@mullerstd/load-env'

const env = loadEnv()

const dbUrl = env.DATABASE_URL

...

Readme

Keywords

none

Package Sidebar

Install

npm i @mullerstd/load-env

Weekly Downloads

0

Version

0.0.3

License

none

Unpacked Size

5.22 kB

Total Files

8

Last publish

Collaborators

  • mullerstd