diff --git a/bin/www b/bin/www index 9618fff..9c4c5b6 100755 --- a/bin/www +++ b/bin/www @@ -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); /** diff --git a/config.json.sample b/config.json.sample new file mode 100644 index 0000000..c80bdb9 --- /dev/null +++ b/config.json.sample @@ -0,0 +1,16 @@ +{ + "mainConfig": [ + { + "param": "port", + "value": "3030" + }, + { + "param": "byeLabel", + "value": "0000" + }, + { + "param": "tbdLabel", + "value": "/dev/tty.usbmodemFD121" + } + ] +} diff --git a/package.json b/package.json index d058f5e..a5e6de5 100644 --- a/package.json +++ b/package.json @@ -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"