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

@randlabs/js-config-reader

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@randlabs/js-config-reader

Configuration settings loader

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-87.5%
Maintainers
2
Weekly downloads
 
Created
Source

js-config-reader

Config Reader is a module to ease configuration settings load and validation with the help of JSON schemas.

Installation

npm install --save @randlabs/js-config-reader

Usage

const ConfigReader = require("@randlabs/js-config-reader");

const settings = await ConfigReader.initialize(options);

Example

const ConfigReader = require("@randlabs/js-config-reader");
 
const settings = await ConfigReader.initialize({
    source: path.join(__dirname, "./settings.json"),
    schema: path.join(__dirname, "./settings.schema.json")
});

The options parameter is an object with the following fields:

  • source - Source location of the configuration settings. Can be a filename or url depending on the used loader. Optional.
  • envVar - Environment variable name used to find the source. Optional. I.e.: Define export MY_SETTINGS=/home/myuser/settings.json and set MY_SETTINGS as the envVar.
  • cmdLineParam - Command-line parameter to use to find the source. Optional. I.e.: If settings is specified, then the code will look for the --settings command-line parameter.
  • loader - Loader function used to load the configuration settings. Optional.
  • schema - Schema location or JSON Schema object to validate configuration settings. Optional.
  • schemaOpts - Additional options to pass to the JSON Schema validator. Optional.
  • extendedValidator - Specifies an additional settings validator. Optional.
  • usingClusters - Prepares usage for a cluster environment. Optional.

License

Apache 2.0

Keywords

FAQs

Package last updated on 21 Mar 2021

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