Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An intelligent routing proxy for npm with support for: private, whitelisted, and blacklisted packaged

License

NotificationsYou must be signed in to change notification settings

nextorigin/smart-private-npm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build status

An intelligent routing proxy for npm with support for: private, whitelisted, and blacklisted packages.

Sample Usage

n.b. Default CouchDB rewrites automatically loaded fromconfig/rewrites.js.

varsmartPrivateNpm=require('smart-private-npm'),url=require('url');//// Configure your private npm. You could load this in from a file// somewhere//varconfig={//// Private npm options.//rewrites:require('./config/rewrites'),proxy:{//// This can optionally just be a single url.parsed URL or an array to// cycle through. Optionally you can also have an array of url.parsed urls// as well//npm:{read:url.parse('http://user:pass@registry.nodejitsu.com'),write:url.parse('https://registry.npmjs.org')},policy:{npm:url.parse('http://user:pass@private.registry.nodejitsu.com'),private:{//// This is the list of "known private modules"// that will always be proxied to the private npm.// It is built over time by remembering "publish" requests.//},blacklist:{//// This is the list of modules that will ALWAYS be proxies// to the private npm, no matter what.//},whitelist:{//// If enabled: only requests for these modules will be served// by the proxy (unless they are "known private modules").//},//// In "transparent mode" the proxy will always forward to// the public registry.//transparent:false}},//// Server options (from "create-servers")//http:80,https:{port:443,root:'/path/to/your/ssl/files',key:'your-ssl.key',// or .pemcert:'your-ssl.cert'// or .pem}};smartPrivateNpm.createServer(config,function(err,servers){if(err){console.log('Error starting private npm: %j',servers);returnprocess.exit(1);}console.log('Private npm running on %j servers.',Object.keys(servers));});

Understanding a Policy

In order to get yoursmart-private-npm setup you'll need to decide on a policy for your users, which are assumed to be authenticated by theCouchDB and the npm CouchApp. A policy is composed of:

  • Private: This is the set of "known private packages" whichare always proxied to your private CouchDB server. All newpublish requests are also proxied to your private CouchDB server.
  • Blacklist: These packages are explicitly forbidden to be retrieved from the public npm.It is possible for a package to be both private and blacklisted. This is how you can take ownership over a given module.
  • Whitelist: If set,only these packages (and all private npm packages) will be permitted from the public npm registry.

Both the sets of whitelisted and blacklisted packages are read from on start time and require updating from the caller.

License: Apache2

About

An intelligent routing proxy for npm with support for: private, whitelisted, and blacklisted packaged

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript99.4%
  • Shell0.6%

[8]ページ先頭

©2009-2025 Movatter.jp