|
|
@ -22,6 +22,14 @@ function getArgs () { |
|
|
|
} |
|
|
|
const args = getArgs(); |
|
|
|
|
|
|
|
function mysearch(nameKey, myArray){ |
|
|
|
for (var i=0; i < myArray.length; i++) { |
|
|
|
if (myArray[i].name === nameKey) { |
|
|
|
return myArray[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const { spawn, exec, execSync } = require('child_process') |
|
|
|
//console.log(args)
|
|
|
|
|
|
|
@ -39,6 +47,10 @@ if (args["insert"] == 'yes'){ |
|
|
|
var dbNamePort = args["port"] |
|
|
|
var dbNameIP = args["ip"] |
|
|
|
var dbdate = args["json"] |
|
|
|
var stackid = args["stackid"] |
|
|
|
var stackinterface = args["stackinterface"] |
|
|
|
var stackpeer = args["stackpeer"] |
|
|
|
var devname = args["devname"] |
|
|
|
|
|
|
|
var showexec ='/usr/local/bin/wg-json'; |
|
|
|
try { |
|
|
@ -47,7 +59,8 @@ if (args["insert"] == 'yes'){ |
|
|
|
NODE_ENV: "production", |
|
|
|
}, |
|
|
|
}); |
|
|
|
var datajson = stdout.toString() |
|
|
|
var datajsontmp = stdout.toString() |
|
|
|
var datajson = mysearch(devname, datajsontmp); |
|
|
|
console.error('exec ' + JSON.stringify(datajson)); |
|
|
|
} catch (error) { |
|
|
|
var datajson = error.toString() |
|
|
@ -57,6 +70,10 @@ if (args["insert"] == 'yes'){ |
|
|
|
var RESlog = new Object(); |
|
|
|
RESlog.date = dbdate |
|
|
|
RESlog.log = datajson |
|
|
|
RESlog.stackid = stackid |
|
|
|
RESlog.stackinterface = stackinterface |
|
|
|
RESlog.stackpeer = stackpeer |
|
|
|
RESlog.devname = devname |
|
|
|
|
|
|
|
|
|
|
|
var MongoClient = require('mongodb').MongoClient; |
|
|
|