Add basic command line options
This commit is contained in:
parent
8837ead540
commit
eb70e8bb0d
2 changed files with 23 additions and 2 deletions
|
@ -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"
|
||||||
|
|
24
src/main.js
24
src/main.js
|
@ -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
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue