mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 09:55:18 +00:00
Added missing dependency. Extracted to single file a repeated function.
This commit is contained in:
parent
893cd5b7a9
commit
5b2976279a
@ -33,6 +33,7 @@
|
||||
"angular-cookies": "1.6.5",
|
||||
"angular-material": "1.1.1",
|
||||
"angular-md5": "^0.1.10",
|
||||
"ansicolors": "^0.3.2",
|
||||
"bootstrap": "3.3.6",
|
||||
"install": "^0.10.1",
|
||||
"needle": "^2.0.1",
|
||||
|
@ -1,3 +1,5 @@
|
||||
const getPath = require('../../util/get-path');
|
||||
|
||||
module.exports = function (server, options) {
|
||||
// Require some libraries
|
||||
const fs = require('fs');
|
||||
@ -84,28 +86,6 @@ module.exports = function (server, options) {
|
||||
}
|
||||
};
|
||||
|
||||
const getPath = (wapi_config) => {
|
||||
console.log(wapi_config);
|
||||
var path = wapi_config.url;
|
||||
var protocol;
|
||||
if(wapi_config.url.startsWith("https://")){
|
||||
protocol = "https://";
|
||||
}
|
||||
else if(wapi_config.url.startsWith("http://")){
|
||||
protocol = "http://";
|
||||
}
|
||||
|
||||
if(path.lastIndexOf("/") > protocol.length){
|
||||
path = path.substr(0, path.substr(protocol.length).indexOf("/") + protocol.length) +
|
||||
":" + wapi_config.port + path.substr(path.substr(protocol.length).indexOf("/") + protocol.length);
|
||||
}
|
||||
else{
|
||||
path = wapi_config.url + ':' + wapi_config.port;
|
||||
}
|
||||
console.log(path);
|
||||
return path;
|
||||
};
|
||||
|
||||
var getPciRequirement = function (req,reply) {
|
||||
var pciRequirements = {};
|
||||
var pci_description = "";
|
||||
|
@ -3,7 +3,7 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
var cron = require('node-cron');
|
||||
var needle = require('needle');
|
||||
|
||||
const getPath = require('../util/get-path');
|
||||
// Colors for console logging
|
||||
const colors = require('ansicolors');
|
||||
const blueWazuh = colors.blue('wazuh');
|
||||
@ -30,26 +30,6 @@ module.exports = function (server, options) {
|
||||
server.log([blueWazuh, 'Wazuh agents monitoring', 'error'], 'Could not read the Wazuh package file.');
|
||||
}
|
||||
|
||||
const getPath = (wapi_config) => {
|
||||
console.log(wapi_config);
|
||||
var path = wapi_config.url;
|
||||
var protocol;
|
||||
if (wapi_config.url.startsWith("https://")) {
|
||||
protocol = "https://";
|
||||
} else if (wapi_config.url.startsWith("http://")) {
|
||||
protocol = "http://";
|
||||
}
|
||||
|
||||
if (path.lastIndexOf("/") > protocol.length) {
|
||||
path = path.substr(0, path.substr(protocol.length).indexOf("/") + protocol.length) +
|
||||
":" + wapi_config.port + path.substr(path.substr(protocol.length).indexOf("/") + protocol.length);
|
||||
} else {
|
||||
path = wapi_config.url + ':' + wapi_config.port;
|
||||
}
|
||||
console.log(path);
|
||||
return path;
|
||||
};
|
||||
|
||||
// Check status and get agent status array
|
||||
var checkStatus = function (apiEntry, maxSize, offset) {
|
||||
if (!maxSize) {
|
||||
|
18
util/get-path.js
Normal file
18
util/get-path.js
Normal file
@ -0,0 +1,18 @@
|
||||
module.exports = (wapiConfig) => {
|
||||
let path = wapiConfig.url;
|
||||
let protocol;
|
||||
if (wapiConfig.url.startsWith("https://")) {
|
||||
protocol = "https://";
|
||||
} else if (wapiConfig.url.startsWith("http://")) {
|
||||
protocol = "http://";
|
||||
}
|
||||
|
||||
if (path.lastIndexOf("/") > protocol.length) {
|
||||
path = path.substr(0, path.substr(protocol.length).indexOf("/") + protocol.length) +
|
||||
":" + wapiConfig.port +
|
||||
path.substr(path.substr(protocol.length).indexOf("/") + protocol.length);
|
||||
} else {
|
||||
path = `${wapiConfig.url}:${wapiConfig.port}`;
|
||||
}
|
||||
return path;
|
||||
};
|
Loading…
Reference in New Issue
Block a user