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

@myob-oss/config

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@myob-oss/config

A simple, predictable configuration module.

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43
decreased by-53.76%
Maintainers
1
Weekly downloads
 
Created
Source

@myob-oss/config

A simple, predictable configuration module for Node.js applications.

This uses the environment variable NODE_ENV to determine which configuration file to load.

The module assumes that all the configuration files in JSON are in the /config folder at the top level of the project. The JSON files can have comments in them, as the module uses the json5 module to parse the config files.

The module loads 3 configuration files in the following order (each overwrites the previous if they have the same key):

  • default.json
  • environment.json (where environment is taken from the NODE_ENV environment variable. It uses "production" as default if the environment variable is not set)
  • runtime.json

Each configuration file will override values from the previous file. For example:

default.json

{
  "foo": "bar",
  "hello": "there"
}

production.json

{
  "my": "goodness"
}

runtime.json

{
  "foo": "baz",
  "au": "revoir"
}

The resulting config will be:

{
  "foo": "baz",
  "hello": "there",
  "au": "revoir",
  "my": "goodness"
}

This uses the deepmerge module to do the merging of the configuration objects.

To use the module, you simply require it, and it exposes the configuration as an Object.

const config = require('@myob-oss/config');

console.log(config.foo); // prints "baz" from the example above.

Testing

To run the tests use the following command.

npm test

Code Coverage

To run the coverage scanner and generate coverage report use the following command. It fails if the threshold coverage has not passed. The threshold settings are stored in test/.istanbul.yml.

npm run cover

Linting

To run the linting checking run the following command.

npm run lint

Keywords

FAQs

Package last updated on 25 Nov 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc