Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return row.application_name.replace(this.applicationNamePrefix, "");
}) as [string];
// check if number of nodes has changed
let knownNodeIds: string[] = [];
try {
// TODO: Evaluate if its a good idea to push it into container or keep it as a public readonly property of DB
knownNodeIds = Container.get("knownNodeIds");
} catch {
// ignore error
}
if (knownNodeIds.length !== nodeIds.length) {
knownNodeIds = nodeIds;
// update known IDs in DI
Container.set("knownNodeIds", knownNodeIds);
this.logger.debug("Postgres number connected clients changed", knownNodeIds);
this.eventEmitter.emit("connected.nodes.changed");
}
} catch (err) {
this.logger.warn("updateNodeIdsFromDb", err);
}
}
constructor() {
this.applicationConfig = this.loadApplicationConfig();
this.registerConfig("Config", `${__dirname}/../config`);
const namespace = this.config.Config.namespace;
this.ENVIRONMENT = EnvironmentBuilder.buildEnvironment(this.NODE_ENV, namespace);
Container.set("ENVIRONMENT", JSON.parse(JSON.stringify(this.ENVIRONMENT)));
}