-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
36 lines (32 loc) · 894 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
30
31
32
33
34
35
36
#!/usr/bin/env node
import {startServer} from './src/server.js';
// Define default config
const config = {
port: 80, // client port to connect to
host: 'localhost', // client url to connect to
id: 1, // robot id
mock: false, // if we want to mock robot
canIf: 'can1' // what can interface we want to use
}
// Process the arguments
process.argv.forEach(function (val, i, arr) {
switch( val ) {
case "-p":
case "--port":
config.port = arr[i+1]
break;
case "-h":
case "--host":
config.host = arr[i+1]
break;
case "--mock":
config.mock = true;
break;
case "--can":
config.canIf = arr[i+1]
break;
default:
}
});
// Start the server
startServer( config );