diff --git a/lib/expressapp.js b/lib/expressapp.js index 2896b1c..bfc402b 100644 --- a/lib/expressapp.js +++ b/lib/expressapp.js @@ -171,16 +171,21 @@ ExpressApp.prototype.start = function(opts, cb) { }; + var createWalletLimiter; if (Defaults.RateLimit.createWallet) { log.info('', 'Limiting wallet creation per IP: %d req/h', (Defaults.RateLimit.createWallet.max / Defaults.RateLimit.createWallet.windowMs * 60 * 60 * 1000).toFixed(2)) - var createWalletLimiter = new RateLimit(Defaults.RateLimit.createWallet); - router.use(/\/v\d+\/wallets\/$/, createWalletLimiter) + createWalletLimiter = new RateLimit(Defaults.RateLimit.createWallet); + // router.use(/\/v\d+\/wallets\/$/, createWalletLimiter) + } else { + createWalletLimiter = function(req, res, next) { + next() + }; } // DEPRECATED - router.post('/v1/wallets/', function(req, res) { + router.post('/v1/wallets/', createWalletLimiter, function(req, res) { logDeprecated(req); var server; try { @@ -197,7 +202,7 @@ ExpressApp.prototype.start = function(opts, cb) { }); }); - router.post('/v2/wallets/', function(req, res) { + router.post('/v2/wallets/', createWalletLimiter, function(req, res) { var server; try { server = getServer(req, res);