Port from configfile

This commit is contained in:
Lukas Bachschwell 2017-03-20 23:09:12 +01:00
parent 5ba8ca3bca
commit e084a26833
3 changed files with 21 additions and 1 deletions

View File

@ -7,12 +7,15 @@
var app = require('../app');
var debug = require('debug')('uniScore:server');
var http = require('http');
var low = require('lowdb');
var config = low('config.json');
var portNumber = config.get('mainConfig').chain().find({ param: 'port' }).value()['value'];
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
var port = normalizePort( portNumber || process.env.PORT || '3000');
app.set('port', port);
/**

16
config.json.sample Normal file
View File

@ -0,0 +1,16 @@
{
"mainConfig": [
{
"param": "port",
"value": "3030"
},
{
"param": "byeLabel",
"value": "0000"
},
{
"param": "tbdLabel",
"value": "/dev/tty.usbmodemFD121"
}
]
}

View File

@ -13,6 +13,7 @@
"express": "~4.13.1",
"express-session": "^1.15.1",
"hbs": "~3.1.0",
"lowdb": "^0.16.0",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0",
"socketio": "^1.0.0"