add command line arguments
This commit is contained in:
parent
4f42723f4a
commit
1160466cf9
13 changed files with 129 additions and 7 deletions
|
@ -1,5 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const commander = require('commander');
|
||||
|
||||
const GameServer = require('./game/');
|
||||
const WebServer = require('./web/');
|
||||
const ServerInterface = require('./interface.js');
|
||||
|
@ -10,6 +12,17 @@ class WingbaseServer extends ServerInterface {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
let port = process.env.PORT || 8080;
|
||||
|
||||
commander
|
||||
.version(packageJson.version)
|
||||
.option('-d, --development', 'run in development mode')
|
||||
.option('-p, --port [port]', 'specify port to use', port)
|
||||
.parse(process.argv);
|
||||
|
||||
this.args = commander;
|
||||
console.log(commander.port);
|
||||
|
||||
process.on('SIGINT', this.stop.bind(this));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue