Added command-line options.
This commit is contained in:
Родитель
12efa3a42a
Коммит
e0cf20878e
|
@ -23,12 +23,31 @@ colors.setTheme({
|
|||
error: 'red'
|
||||
});
|
||||
|
||||
// Default initialized options.
|
||||
var options = {
|
||||
key: fs.readFileSync(__dirname + '/../keys/key.pem'),
|
||||
cert: fs.readFileSync(__dirname + '/../keys/crt.pem'),
|
||||
port: 55073
|
||||
};
|
||||
// Parse command-line arguments.
|
||||
var options = require('optimist')
|
||||
.options({
|
||||
port: {
|
||||
demand: true,
|
||||
alias: 'p',
|
||||
description: 'Listen port',
|
||||
default: 55073
|
||||
},
|
||||
keyPath: {
|
||||
demand: true,
|
||||
alias: 'k',
|
||||
description: 'SSL key path',
|
||||
default: __dirname + '/../keys/key.pem',
|
||||
},
|
||||
certPath: {
|
||||
demand: true,
|
||||
alias: 'c',
|
||||
description: 'SSL certificate path',
|
||||
default: __dirname + '/../keys/crt.pem',
|
||||
}
|
||||
}).argv;
|
||||
|
||||
options.key = fs.readFileSync(options.keyPath);
|
||||
options.cert = fs.readFileSync(options.certPath);
|
||||
|
||||
// Shortens the given URL to given maxLen by inserting '...'.
|
||||
function shortenUrl(url, maxLen) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
"spdy": "~1.26.0",
|
||||
"colors": "~0.6.2",
|
||||
"memory-cache": "0.0.5",
|
||||
"png": "~3.0.3"
|
||||
"png": "~3.0.3",
|
||||
"optimist": "~0.6.1"
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче