Commit b662673f55d030d9f7483050a63dc9ac7f7e995b

Authored by Adhidarma Hadiwinoto
1 parent c213aeb096
Exists in master

matrix hostid

Showing 2 changed files with 19 additions and 1 deletions Side-by-side Diff

1 1 "use strict";
2 2  
3 3 const simpleGit = require('simple-git');
  4 +const macaddress = require('macaddress');
  5 +const machineid = require('node-machine-id');
  6 +const sha1 = require('sha1');
4 7  
5   -const matrix = {};
  8 +const matrix = {
  9 + matrix.host_id: null
  10 +};
6 11  
7 12 // get active git version
8 13 simpleGit(process.cwd()).raw(
... ... @@ -17,4 +22,14 @@ simpleGit(process.cwd()).raw(
17 22 }
18 23 )
19 24  
  25 +macaddress.one(function(err, mac) {
  26 + if (err) return;
  27 +
  28 + matrix.host_id.mac = mac;
  29 +})
  30 +
  31 +matrix.host_id.machineid = machineid.machineIdSync();
  32 +
  33 +matrix.host_id_hash = sha1('KOMODO' + matrix.host_id.machineid + matrix.host_id.mac);
  34 +
20 35 module.exports = matrix;
... ... @@ -24,12 +24,15 @@
24 24 "express": "^4.16.2",
25 25 "express-session": "^1.15.6",
26 26 "lru-cache": "^4.1.1",
  27 + "macaddress": "^0.2.8",
27 28 "moment": "^2.19.1",
  29 + "node-machine-id": "^1.1.10",
28 30 "node-natural-sort": "^0.8.6",
29 31 "numeral": "^2.0.6",
30 32 "nunjucks": "^3.0.1",
31 33 "redis": "^2.8.0",
32 34 "request": "^2.81.0",
  35 + "sha1": "^1.1.1",
33 36 "simple-git": "^1.80.1",
34 37 "strftime": "^0.10.0",
35 38 "uniqid": "^4.1.1",