Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const register = function(config) {
RED.nodes.createNode(this, config);
var node = this;
node.status({});
//select the config node depending on config
let selectorFactory = new DbSelectorFactory();
let selector = selectorFactory.create(config, databaseRegistry.values);
if(!selector) {
return node.status({ fill: "red", shape: "dot", text: "Database type '"+config["server-type"]+"' is not defined" });
}
this.server = RED.nodes.getNode(selector.config);
//the config node can't be found in the flow
if(!this.server) {
return node.status({ fill: "red", shape: "dot", text: "Database configuration missing" });
}
//the config node is incomplete and doesn't define a database manager
if(this.server.databaseManager === undefined || this.server.databaseManager instanceof DatabaseManager === false) {
node.error("Database Manager for "+config.type+" must be set.");
}
const register = function(config) {
RED.nodes.createNode(this, config);
var node = this;
node.status({});
//select the config node depending on config
let selectorFactory = new DbSelectorFactory();
let selector = selectorFactory.create(config, databaseRegistry.values);
if(!selector) {
return node.status({ fill: "red", shape: "dot", text: "Database type '"+config["server-type"]+"' is not defined" });
}
this.server = RED.nodes.getNode(selector.config);
//the config node can't be found in the flow
if(!this.server) {
return node.status({ fill: "red", shape: "dot", text: "Database configuration missing" });
}
//the config node is incomplete and doesn't define a database manager
if(this.server.databaseManager === undefined || this.server.databaseManager instanceof DatabaseManager === false) {
node.error("Database Manager for "+config.type+" must be set.");
}