ewdave / envmap

Simple Environment Variables mapping tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ENVMAP

Map environment variables easily

You don't not have to do this to map your specific environment variables -

GOOGLE_APP_ID: process.env.GOOGLE_APP_ID,
GOOGLE_APP_SECRET: process.env.GOOGLE_APP_SECRET,
GOOGLE_TOKEN: process.env.GOOGLE_TOKEN,
GOOGLE_CB_URL: process.env.GOOGLE_CB_URL

Replace that whole flow by using envmap

Install from npm

$ npm install --save envmap

Usage


import env from 'envmap';

//`env.prefix('')` takes in a parameter -- namespace prefix to use for environment variable lookups
const GOOGLE = env.prefix('google_');

// on finding matching environment variables, it'll return an object with the env variables lower-cased and stripped.
/*
GOOGLE {
  app_id: '...',
  app_secret: '...',
  token: '...',
  cb_url: '...'
}
*/

About

Simple Environment Variables mapping tool


Languages

Language:JavaScript 100.0%