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

http-master-example-httploader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-master-example-httploader

Example config loader for http-master

latest
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

http-master-example-httploader

This example repository shows how to provide config to http-master from a remote source. Http is used in here but obviously any other asynchronous config fetching method can be used, for example fetching from Redit, MySQL etc.

About config loaders

Config loader can be any Node.JS module (along with its node_modules) which may reside anywhere on the filesystem.

This module should export a function which accepts 3 arguments: argv - object representing http-master arguments, may be used for convenience data - utf8 content of file read by --config finish - function with parameters (err, config) which the module should call after receiving a request. It may also be called when after initial request the config has changed.

Note: if --watchConfig was passed, this function may be called multiple times due to file passed as --config changing

module.exports = function(argv, data, finish) {
 // module logic here
}

Using example loader

  • Clone into /path/to/http-master-example-httploader and install dependencies with npm install

  • Create config.json with contents (or use example one from this repo for demo)

{
  "url": "https://raw2.github.com/CodeCharmLtd/http-master-example-httploader/master/sample.json"
}

http-master --config config.json --configloader /path/to/http-master-example-httploader --show-rules

Making a general use loader

One could publish a loader to NPM and allow global install. You could then use it as. npm install -g http-master-example-httploader

http-master --config config.json --configloader http-master-example-httploader --show-rules

FAQs

Package last updated on 27 Jan 2014

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