#!/usr/bin/env node var fs = require('fs'), program = require('commander'); var numeric = function (v) { return parseInt(v, 10); }; program .version(JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version) .option('-h, --host [name]', 'Hostname [localhost]', 'localhost') .option('-p, --port [number]', 'An integer argument [8080]', numeric, 8080) .option('-t, --ttl [seconds]', 'Cache lifetime in seconds [1800]', numeric, 1800) .option('-s, --storage [path]', 'Storage path', __dirname + '/../cache') .option('-x, --proxy [address]', 'HTTP proxy to be used, e.g. http://user:pass@example.com:8888/') .option('-e, --expired', 'Use expired cache when npm registry unavailable') .option('-f, --friendly-names', 'Use actual file names instead of hashes in the cache') .option('-v, --verbose', 'Verbose mode') .option('-n, --metadata-excluded', 'Exclude metadata requests from caching') .option('-l, --log-path [path]', 'Log path') .option('-m, --internal-port [port]', 'HTTPs port to use for internal proxying "MITM" server (mandatory on Windows systems)') .parse(process.argv); require('../lib/proxy').powerup(program);