rate-limiter-flexible
Advanced tools
Comparing version 0.17.1 to 0.17.2
@@ -17,2 +17,3 @@ const RateLimiterStoreAbstract = require('./RateLimiterStoreAbstract'); | ||
this.dbName = opts.dbName; | ||
if (opts.mongo) { | ||
@@ -35,2 +36,10 @@ this.client = opts.mongo; | ||
get dbName() { | ||
return this._dbName; | ||
} | ||
set dbName(value) { | ||
this._dbName = typeof value === 'undefined' ? RateLimiterMongo.getDbName() : value; | ||
} | ||
static getDbName() { | ||
@@ -54,3 +63,3 @@ return 'node-rate-limiter-flexible'; | ||
if (typeof this.client.db === 'function') { | ||
collection = this.client.db(RateLimiterMongo.getDbName()).collection(this.keyPrefix); | ||
collection = this.client.db(this.dbName).collection(this.keyPrefix); | ||
} else { | ||
@@ -57,0 +66,0 @@ collection = this.client.db.collection(this.keyPrefix); |
{ | ||
"name": "rate-limiter-flexible", | ||
"version": "0.17.1", | ||
"version": "0.17.2", | ||
"description": "Flexible API rate limiter backed by Redis for distributed node.js applications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -152,2 +152,7 @@ [![Build Status](https://travis-ci.org/animir/node-rate-limiter-flexible.png)](https://travis-ci.org/animir/node-rate-limiter-flexible) | ||
#### Options specific to Mongo | ||
* `dbName` `Default: 'node-rate-limiter-flexible'` Database where limits are stored. It is created during creating a limiter. | ||
Doesn't work with Mongoose, as mongoose connection is established to exact database. | ||
#### Options specific to Cluster | ||
@@ -154,0 +159,0 @@ |
69680
1816
372