0.0.2 • Published 4 years ago
env-man v0.0.2
Env-Manager
Methods
config- This method will load environment variables into process.env object from the/folder/.envwhere folder is a parameter passed to the config method.set- This method accepts two parameters:parameter 1key - set on process.env objectparameter 2the value to be stored on process.envkey
get- This method accepts one parameter:keyand returns the value ofprocess.env[key];loadFromFile- Accepts one parameter:filePath, this method loads environment variables from specified filePath into the process.env object for use in the current executing program.
Installation
npm install env-managerExamples
Basic Usage
The example below will load environment variables from a .env file in the current folder.
require("env-manager").config(__dirname);Set values
const envManager = require("env-manager");
envManager.set("DB_HOST", "...."); // process.env.DB_HOST = "...."Get values
const envManager = require("env-manager");
console.log(envManager.get("DB_HOST"));
// outputs value of process.env.DB_HOSTContributions
Your contributions are welcome no matter how small.
License
MIT Licensed.