2.0.2 • Published 6 months ago

dotenv-auto v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

dotenv-auto

This lib automatically loads .env files according to to the standard .env file resolution and then replaces all references in your code to process.env.[VARNAME].

Install

npm install dotenv-auto
# OR
yarn add dotenv-auto
# OR
pnpm add dotenv-auto

Usage

Simply import at the top of the file.

import 'dotenv-auto';

API

config()

Sometimes it is necessary to manually reload, so you can use:

import { config } from 'dotenv-auto/api';

config();

console.log(process.env.APP_NAME);

env()

To retrieve a single key value, just use env:

import { env } from 'dotenv-auto/api';

const appName = env('APP_NAME');

console.log(process.env.APP_NAME);
2.0.2

6 months ago

2.0.1

6 months ago

1.1.0

8 months ago

1.0.0

9 months ago