New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bitmex/env12

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bitmex/env12

env12 is a simple library for making it easier to handle configuration for 12 factor applications in NodeJS.

0.0.6
latest
Source
npm
Version published
Weekly downloads
4
Maintainers
2
Weekly downloads
 
Created
Source

env12

env12 is a simple library for making it easier to handle configuration for 12 factor applications in NodeJS.

License

MIT

Reference

There is a single exported function named merge. This function will look at process.env and add settings into the passed in environment object.

merge

  • @env: The config environment object to merge the environment variables into.
  • @prefix: A prefix that the environment variables must have to be added, which will be stripped from the key in @env.

Runs through the environment variables for the process and adds them to @env if the prefix matches. All values will be coerced via JSON.parse, so they should be the correct type.

For the following examples, assume the environment has the following variables set:

foo=bar
app_foo=baz
app_baz_bar=1

Note that the value returned is from APP_FOO and not FOO as FOO was ignored because it is not prefixed.

let settings = {};
env12.merge(settings, prefix="app");
console.log(JSON.stringify(settings));
> {"app": "baz", "baz": {"bar": 1}}

FAQs

Package last updated on 13 Aug 2018

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