0.1.1 • Published 3 years ago
@bergerapi/env v0.1.1
env
Simple dotenv clone with extended functionality.
Usage
Installation
With NPM
npm i @bergerapi/env
With Yarn
yarn add @bergerapi/env
Implementation
Create an .env file in your project directory.
TEST=test_string123Then add following code to your entry file (e.g. index.ts)
import { env } from "@bergerapi/env";
env();And use a variable with
console.log(process.env.TEST);Configuration
@bergerapi/env allows you to change the file which it will parse by passing the path as a parameter to the env() function.
env("../postgres.env")You can also call this function multiple times to use multiple .env files as long as they do not contain variables whose names collide with other variables already defined.