diff --git a/setup.js b/setup.js index 210e761..3430faf 100644 --- a/setup.js +++ b/setup.js @@ -1,3 +1,11 @@ +// listen port +exports.port = 80; + +// uid and gid to drop root priv. +exports.uid = 'light'; +exports.gid = 'users'; + +// setup devices exports.setup = { presets: [ { diff --git a/web.js b/web.js index 19b532d..c8b4111 100644 --- a/web.js +++ b/web.js @@ -49,7 +49,15 @@ exports.init = function(dmx) { var app = http.createServer(handler) - app.listen(8080, '::'); + app.listen(setup.port, '::', null, function() { + try { + process.setuid(setup.uid); + process.setgid(setup.gid); + } catch (err) { + console.log(err); + process.exit(1); + } + }); io.listen(app).sockets.on('connection', function (socket) { socket.emit('init', {'devices': dmx.devices, 'setup': dmx.setup});