Created
February 29, 2020 20:21
-
-
Save liesislukas/37d5facc8479a78b1e888fcfcfe33a47 to your computer and use it in GitHub Desktop.
npm_lazy (local cache server for npm)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm_lazy config | |
module.exports = { | |
// Logging config | |
loggingOpts: { | |
// show the ip address of the machine requesting the npm package | |
logRequesterIP: true, | |
// Print to stdout with colors | |
logToConsole: true, | |
// Write to file | |
logToFile: false, | |
// This should be a file path. | |
filename: '/Volumes/extra_space/www/npm_lazy/npm_lazy.log', | |
}, | |
// Cache config | |
// `cacheDirectory`: Directory to store cached packages. | |
// | |
// Note: Since any relative path is resolved relative to the current working | |
// directory when the server is started, you should use a full path. | |
cacheDirectory: '/Volumes/extra_space/www/npm_lazy/cache', | |
// `cacheAge`: maximum age before an index is refreshed from remoteUrl | |
// - negative value means no refresh (e.g. once cached, never update the package.json metadata) | |
// - zero means always refresh (e.g. always ask the registry for metadata) | |
// - positive value means refresh every n milliseconds | |
// (e.g. 60 * 60 * 1000 = expire metadata every 60 minutes) | |
// | |
// Note: if you want to use `npm star` and other methods which update | |
// npm metadata, you will need to set cacheAge to 0. npm generally wants the latest | |
// package metadata version so caching package metadata will interfere with it. | |
// Recommended setting: 0 | |
cacheAge: 0, | |
// Request config | |
// max milliseconds to wait for each HTTP response | |
httpTimeout: 10000, | |
// maximum number of retries per HTTP resource to get | |
maxRetries: 5, | |
// whether or not HTTPS requests are checked against Node's list of CAs | |
// set false if you are using your own npm mirror with a self-signed SSL cert | |
rejectUnauthorized: true, | |
// Remote and local URL | |
// external url to npm_lazy, no trailing / | |
externalUrl: 'http://localhost:8080', | |
// registry url with trailing / | |
remoteUrl: 'https://registry.npmjs.com/', | |
// bind port and host | |
port: 8080, | |
host: '0.0.0.0', | |
// Proxy config | |
// You can also configure this using the http_proxy and https_proxy environment variables | |
// cf. https://wiki.archlinux.org/index.php/proxy_settings | |
proxy: { | |
// http: 'http://1.2.3.4:80/', | |
// https: 'http://4.3.2.1:80/' | |
}, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pm2 config | |
module.exports = { | |
apps: [ | |
{ | |
name: 'npm_lazy', | |
script: 'npm_lazy --config /Volumes/extra_space/www/npm_lazy/config.js', | |
// Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/ | |
instances: '1', | |
error_file: '/Volumes/extra_space/www/npm_lazy/pm2-error.log', | |
out_file: '/Volumes/extra_space/www/npm_lazy/pm2-logs.log', | |
autorestart: true, | |
watch: false, | |
max_memory_restart: '1G', | |
}, | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment