LAPI-298: Update to exit, to log in logs directory and to be able to send GPS

This commit is contained in:
2019-09-25 14:02:03 +03:00
parent 37d906aacd
commit ea2e0168d3
7 changed files with 133 additions and 59 deletions

View File

@ -6,7 +6,7 @@ var NodeCodecs = require('mumble-client-codecs-node');
var fs = require('fs');
var execSync = require('child_process').execSync;
var currentPath = require('path').dirname(require.main.filename);
const utils = require('./utils');
const OpusEncoder = require('node-opus').OpusEncoder;
class Mumble {
@ -29,7 +29,7 @@ class Mumble {
var path = currentPath + '/certs/' + id + '-cert.pem';
if (!fs.existsSync(path)) {
console.log(id, 'Creating certificates...');
utils.writeLog(`Creating certificates for asset ${id}`)
try {
var code = execSync(currentPath + '/createCerts.sh ' + id);
} catch (e) {
@ -37,7 +37,7 @@ class Mumble {
}
return callback(true);
} else {
console.log(id, 'Certificates already created.');
utils.writeLog(`Certificates for asset ${id} already created`);
return callback(true);
}
}
@ -47,15 +47,15 @@ class Mumble {
// If ca does not exist create them.
var rootPath = currentPath + '/certs/root-cert.pem';
if (!fs.existsSync(rootPath)) {
console.log(id, ' - Creating CA certificates...')
try {
execSync('./createCA.sh');
} catch(e) {
utils.writeLog(`Creating certificates for Mumble`);
try { execSync('./createCA.sh'); }
catch(e) {
utils.writeLog(`Could not crete Mumble certificates. Error:${e}`)
throw 'Could not crete CA certificates. ' + e;
}
} else {
utils.writeLog(`Certificates for Mumble already created`);
}
console.log(id,' - CA certificates ok.')
var reconnect = inject(function(){
var args = slice.call(arguments);