node-red-contrib-kafka-manager
Advanced tools
Comparing version 0.2.14 to 0.3.0
@@ -87,3 +87,3 @@ const nodeName="Kafka Broker"; | ||
function testHost (node, i) { | ||
if (i >= node.hosts.length) { | ||
if (i >= node.hostsCombined.length) { | ||
if (!node.available) return | ||
@@ -95,3 +95,3 @@ node.available = false | ||
} | ||
const host = node.hosts[i] | ||
const host = node.hostsCombined[i] | ||
if(logger.active) logger.send({ | ||
@@ -167,3 +167,3 @@ label: 'testHost', | ||
} | ||
if (!node.brokerNode.hosts.length) { | ||
if (!node.brokerNode.hostsCombined.length) { | ||
node.connecting = false | ||
@@ -266,2 +266,30 @@ node.log('host and/or port not defined') | ||
}) | ||
node.hostsCombined=[]; | ||
if(node.hostsEnvVar) { | ||
if(node.hostsEnvVar in process.env) { | ||
try{ | ||
const hosts=JSON.parse(process.env[node.hostsEnvVar]); | ||
if(hosts) { | ||
logger.send({label:"test",hosts:hosts}); | ||
if(hosts instanceof Array) { | ||
node.hostsCombined=node.hostsCombined.concat(hosts); | ||
} else { | ||
throw Error("not array value: "+process.env[node.hostsEnvVar]); | ||
} | ||
} | ||
} catch(e) { | ||
const error="process.env variable "+node.hostsEnvVar+e.toString(); | ||
// node.error(error); | ||
throw Error(error); | ||
} | ||
} else { | ||
const error="process.env."+node.hostsEnvVar+" not found "; | ||
node.warn(error); | ||
node.status({ | ||
fill: 'red', | ||
shape: 'ring', | ||
text: error | ||
}); | ||
} | ||
} | ||
if (node.hosts.length === 0 && node.host) { | ||
@@ -273,3 +301,5 @@ node.hosts.push({ | ||
} | ||
node.kafkaHost = node.hosts.map((r) => r.host + ':' + r.port).join(',') | ||
node.hostsCombined=node.hostsCombined.concat(node.hosts); | ||
logger.send({hosts:node.hostsCombined}); | ||
node.kafkaHost = node.hostsCombined.map((r) => r.host + ':' + r.port).join(',') | ||
@@ -276,0 +306,0 @@ node.getKafkaDriver = () => { |
{ | ||
"name": "node-red-contrib-kafka-manager", | ||
"version": "0.2.14", | ||
"version": "0.3.0", | ||
"description": "Node-RED implements Kafka manager with associand associated .", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -20,4 +20,8 @@ # [node-red-contrib-kafka-manager][2] | ||
Defines the client interface to kafka. | ||
Defines the client interface to kafka. One can add process.env for hosts with | ||
process.env.atesthosts='[{"host":"atesthost1","port":1234},{"host":"atesthost2","port":4321}]'; | ||
in settitngs.js | ||
![Kafka Broker](documentation/broker.JPG "Kafka Broker") | ||
@@ -108,2 +112,3 @@ ![Kafka Broker Options](documentation/brokerOptions.JPG "Kafka Broker Options") | ||
# Version | ||
0.3.0 Add hosts list by process.env | ||
0.2.14 Add self serve TLS and fix bug plus mask ssl info when debug logging | ||
@@ -110,0 +115,0 @@ 0.2.9 Change debugging mechanism and add kafka-node to dependencies |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
884432
1935
150
3