Environment
An efficient Node library for managing and setting environment variables.
Install
$ yarn add @glhrmoura/environment
or
$ npm install @glhrmoura/environment
Usage
Basic
The library is quite simple to use, we just need to import and call a configuration function. The configuration will look for a .env
file at the same level as the file calling it.
import { config } from '@glhrmoura/environment';
config();
envPath
property
Passing The envPath
property refers to the path of the .env
file:
import { config } from '@glhrmoura/environment';
config({ envPath: '/path/envFile' });
envPath
as a list
Passing The envPath
property can also be in the form of a list, receiving multiple paths for different files:
import { config } from '@glhrmoura/environment';
config({ envPath: ['/path/envFileDev', '/path/envFileProd'] });
License
Copyright (c) Guilherme Moura