Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@capriza/connector-controller

Package Overview
Dependencies
Maintainers
1
Versions
345
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capriza/connector-controller - npm Package Compare versions

Comparing version 1.0.23 to 1.0.24

4

outpost/module/configure.js

@@ -22,4 +22,4 @@ const fs = require("fs");

systemConfig: outpost.config.systemConfig,
controllerConfig: controllerConfig ? JSON.parse(controllerConfig) : (vanilla.controllerConfig || {}),
blConfig: blConfig ? JSON.parse(blConfig) : vanilla.blConfig
controllerConfig: (!outpost.config.useVanillaConfig && controllerConfig) ? JSON.parse(controllerConfig) : (vanilla.controllerConfig || {}),
blConfig: (!outpost.config.useVanillaConfig && blConfig) ? JSON.parse(blConfig) : (vanilla.blConfig || {})
}

@@ -26,0 +26,0 @@ fs.writeFileSync("connector/resources/config.json", JSON.stringify(config, null, 2));

@@ -18,2 +18,3 @@ {

"configure": {
"useVanillaConfig": {"type": "boolean", "title": "Use vanilla configuration", "required": true, "default": false},
"connectorId": {"type": "string", "title": "Connector ID", "required": true},

@@ -30,2 +31,3 @@ "systemConfig": {"type": "string", "title": "System Configuration File", "required": true, "default": "/etc/capriza/{{name}}/systemConfig.json"},

"items": [
"useVanillaConfig",
"connectorId",

@@ -32,0 +34,0 @@ "systemConfig",

@@ -5,46 +5,77 @@ const util = require("util");

name = `${name}@${version}`;
// outpost.script("logstash", null, function(err) {
// if (err) {
// outpost.fail("failed to start logstash: " + err);
// return;
// }
outpost.log(`Starting connector ${name}`);
function readdirRecursive (dir) {
return new Promise ((resolve,reject) => {
var results = [];
fs.readdir(dir, function(err, list) {
if (err) return reject(err);
var i = 0;
(function next() {
var file = list[i++];
if (!file) return resolve(results);
file = dir + '/' + file;
fs.stat(file, async function(err, stat) {
if (stat && stat.isDirectory()) {
try {
var res = await readdirRecursive(file);
results = results.concat(res);
next();
} catch (ex) {return reject (ex);}
} else {
results.push(file);
next();
}
});
})();
});
});
}
try {
var prefix = "./connector/node_modules/.bin/.prestart";
var files = fs.readdirSync(prefix);
var origLogger = outpost.log;
files.forEach (file => {
try {
outpost.log = msg => origLogger(`[${file}] ${msg}`);
require(`${prefix}/${file}`);
}
catch (ex){
throw new Error (`Error running prestart script ${prefix}/${file}): ${ex.message}`);
}
finally {
outpost.log = origLogger;
}
});
(async function start () {
name = `${name}@${version}`;
outpost.log(`Starting connector ${name}`);
}
catch (ex){
if (ex.code !== "ENOENT"){
outpost.fail (`Error running prestart scripts: ${ex.message}`);
return;
try {
var prefix = "./connector/node_modules/.bin/.prestart";
var files = await readdirRecursive(prefix);
var origLogger = outpost.log;
files.forEach(file => {
try {
outpost.log = msg => origLogger(`[${file}] ${msg}`);
require(`${prefix}/${file}`);
}
catch (ex) {
throw new Error(`Error running prestart script ${prefix}/${file}: ${ex.message}`);
}
finally {
outpost.log = origLogger;
}
});
}
}
catch (ex) {
if (ex && ex.code != "ENOENT") {
outpost.fail(`Error running prestart scripts: ${ex.message || ex}`);
return;
}
}
process.env["CONTROLLER_TITLE"] = name;
process.env["CONTROLLER_TITLE"] = name;
outpost.monitor({ name , cmd: "./node", cwd: "connector", args: ["node_modules/connector-controller/start.js"], env: process.env }, function(err) {
if (err) {
outpost.fail(name + " failed to start: " + err);
} else {
outpost.log(name + " started");
outpost.done();
}
});
outpost.monitor({
name,
cmd: "./node",
cwd: "connector",
args: ["node_modules/connector-controller/start.js"],
env: process.env
}, function (err) {
if (err) {
outpost.fail(name + " failed to start: " + err);
} else {
outpost.log(name + " started");
outpost.done();
}
});
})();
// });
{
"name": "@capriza/connector-controller",
"version": "1.0.23",
"version": "1.0.24",
"description": "Capriza connectors controller",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc