Add basic command line options

This commit is contained in:
Petr Sloup 2016-03-03 11:17:38 +01:00
parent 8837ead540
commit eb70e8bb0d
2 changed files with 23 additions and 2 deletions

View file

@ -21,6 +21,7 @@
"mapbox-gl-native": "3.0.2-earcut", "mapbox-gl-native": "3.0.2-earcut",
"mbtiles": "0.8.2", "mbtiles": "0.8.2",
"morgan": "1.7.0", "morgan": "1.7.0",
"nomnom": "1.8.1",
"request": "2.69.0", "request": "2.69.0",
"sharp": "0.13.1", "sharp": "0.13.1",
"sphericalmercator": "1.0.4" "sphericalmercator": "1.0.4"

View file

@ -2,7 +2,27 @@
'use strict'; 'use strict';
var opts = require('nomnom')
.option('config', {
abbr: 'c',
default: 'config.json',
help: 'Configuration file'
})
.option('port', {
abbr: 'p',
default: 8080,
help: 'Port'
})
.option('version', {
abbr: 'v',
flag: true,
help: 'Version info',
callback: function() {
return 'version ' + require('../package.json').version;
}
}).parse();
return require('./server')({ return require('./server')({
config: 'config.json', config: opts.config,
port: 8080 port: opts.port
}); });