matrix.js
862 Bytes
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
35
36
37
38
39
"use strict";
const simpleGit = require('simple-git');
//const macaddress = require('macaddress');
const machineid = require('node-machine-id');
//const sha1 = require('sha1');
const matrix = {
//host_id: {}
machineid: machineid.machineIdSync()
};
matrix.machineid_readable = matrix.machineid.match(/.{1,4}/g).join('-');
// get active git version
simpleGit(process.cwd()).raw(
['describe'],
function(err, result) {
if (!err) {
if (result) {
result = result.trim();
}
matrix.version_active = result;
}
}
)
/*
macaddress.one(function(err, mac) {
if (err) return;
matrix.host_id.mac = mac;
})
matrix.host_id.machineid = machineid.machineIdSync();
matrix.host_id_hash = sha1('KOMODO' + matrix.host_id.machineid + matrix.host_id.mac);
*/
module.exports = matrix;