read-replica-db-discover
v1.0.0
Published
receive a database master url and return his read replica url based on paramters
Downloads
21
Maintainers
Readme
read-replica-db-discover
js to receive master URL database and return read replica URL based on parameters.
Installation
npm install read-replica-db-discover
Basic Usage - With default options
const ReadReplicaUrl = require('read-replica-db-discover');
var masterUrl = 'database.cluster-asr3asefaw3.region.vendor.com';
console.log(ReadReplicaUrl(masterUrl));
// result: database.cluster-ro-asr3asefaw3.region.vendor.com
With modified options
const ReadReplicaUrl = require('read-replica-db-discover');
options = {
cluster_master: 'master',
cluster_read: 'master-rr',
database_read: 'rr',
}
var masterUrl = 'database.master-asr3asefaw3.region.vendor.com';
console.log(ReadReplicaUrl(masterUrl));
// result database.master-rr-asr3asefaw3.region.vendor.com
Example
npm run example
ornode example/read-replica-example.js
- Check example code. When you run the example you should have an output in console log.
Test
mocha
ornpm test
- Check test folder.
License
MIT licensed and all it's dependencies are MIT or BSD licensed.