forked from LockerProject/Locker
/
dashboard.js
35 lines (31 loc) · 1.03 KB
/
dashboard.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
/*
*
* Copyright (C) 2011, The Locker Project
* All rights reserved.
*
* Please see the LICENSE file for more information.
*
*/
var spawn = require('child_process').spawn;
var lconfig = require('../Common/node/lconfig.js');
var dashboard;
lconfig.load('config.json');
exports.instance = dashboard;
exports.start = function(port) {
// start dashboard
dashboard = spawn('node', ['dashboard-client.js', lconfig.lockerHost, lconfig.lockerPort, port, lconfig.externalBase],
{cwd: __dirname + '/Dashboard'});
dashboard.uriLocal = 'http://' + lconfig.lockerHost + ':' + port;
dashboard.port = port;
console.log('Spawned dashboard pid: ' + dashboard.pid);
dashboard.stdout.on('data',function (data){
console.log('dashboard stdout: '+data);
});
dashboard.stderr.on('data',function (data){
console.log('Error dashboard: '+data);
});
dashboard.on('exit', function (code) {
if(code > 0) console.log('dashboard died with code ' + code);
});
exports.instance = dashboard;
}