-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
29 lines (24 loc) · 820 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Require dependencies.
var config = require('npm_lazy/config');
var pkg = require('./package.json');
var program = require('commander');
var server = require('npm_lazy/server');
var utils = require('./lib/utils');
// Setup program.
program
.version(pkg.version)
.usage('[options]')
.description('Starts a dynamically configured npm_lazy server instance')
.option('--show-config', 'display the effective server configuration on startup');
// Populate and parse options.
config.proxy.http = config.proxy.https = undefined;
utils.configureProgramOptions(config, program);
program.parse(process.argv);
// Update configuration.
utils.updateConfiguration(config, program);
// Show compiled configuration options, if requested.
if (program.showConfig) {
console.log(config);
}
// Start server.
server(config);