Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.reconnectTimes = opts.reconnectTimes || constants.RETRY.RECONNECT_RETRY;
this.nodePath = this.path + '/' + app.serverType +
constants.RESERVED.ZK_NODE_SEP + app.serverId;
this.cmdPath = this.path + '/' +
constants.RESERVED.ZK_NODE_COMMAND + app.serverId;
this.authentication = this.username + ':' + this.password;
const shaDigest = crypto.createHash('sha1')
.update(this.authentication)
.digest('base64');
const id = new zookeeper.Id('digest', this.username + ':' + shaDigest);
this.acls = [new zookeeper.ACL(zookeeper.Permission.ALL, id)];
this.client = zookeeper.createClient(this.servers, {
sessionTimeout: this.timeout,
retries: this.retries,
spinDelay: this.spinDelay
});
}