New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fine-env

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fine-env

Convert environment vars to convenient nested object.

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

fine-env

Read environment variables from process.env (.env) as convenient nested object.

Store objects and arrays as string variables.

NPM version LICENSE

Install

# with npm
npm install fine-env

# or with yarn
yarn add fine-env

Usage

const env = require('fine-env');

// getting environment vars from env object

// get PORT 
const port = env.port;

// get MONGODB_URL 
const mongodbUrl = env.mongodbUrl;

// get GOOGLE__APP_1__CLIENT_ID and GOOGLE__APP1__CLIENT_SECRET
const { clientId, clientSecret } = env.google.app1;
// or use original keys
const { CLIENT_ID, CLIENT_SECRET } = env.google.app1;

// get SystemRoot
const { SystemRoot } = env;
// or use camelCase style
const { systemRoot } = env;

// get all vars with prefix GOOGLE__
const { google } = env;
// or with require
const { google } = require('fine-env');

// get ROOT_VAR__parentVar__child_Var
const { childVar } = env.rootVar.parentVar;

// get _INIT_UTS__PLATFORM and _INIT_UTS__RELEASE
const db = env.db;
const { platform, release } = env._initUts;

Array storage

FOO__BAR__=111,222,333,444,555
ALLOWED_HOSTS__=localhost,example.com,*.example.com
const env = require('fine-env');

console.log(env.foo.bar); // => [111, 222, 333, 444, 555]
console.log(env.allowedHosts); // => ['localhost', 'example.com', '*.example.com']

License

MIT

Keywords

env

FAQs

Package last updated on 16 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts