vault-high-availability
v1.0.74
Published
In order to make sure that your request going to vault leader node, you can use these package instead of request. This Package is extend of requestRetry package with an option to replace the dns with ip.
Downloads
79
Readme
In order to make sure that your request going to vault leader node, you can use these package instead of request. This Package is extend of requestRetry package with an option to replace the dns with ip.
HOW TO USE:
1- replace request package with:
var vaultHighAvailability = require('vault-high-availability')(server_address);
var request = vaultHighAvailability.request;
2- In your request option add these lines:
var options:{
..
..
time: true,
maxAttempts: process.env.MAX_ATTEMPT_RETRY || defaultRetryTimes, // (default) try 5 times
retryDelay: process.env.RETRY_DELAY || 500, // (default) wait for 5s before trying again
retryStrategy: vaultHighAvailability.networkOrHttpErrorTriggerResolveDNS,
addressResolver: vaultHighAvailability.replaceDnsWithIp
}
This will handle network Or Http Error & will replace the dns with the leader ip