mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-23 01:32:03 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86a58e9ff3 | ||
|
|
d7d722b27b | ||
|
|
d439165dd2 | ||
|
|
65356051f8 | ||
|
|
9728b64edb |
@@ -33,7 +33,9 @@ util.inspect.defaultOptions = { depth: 1 }
|
||||
// let _this
|
||||
|
||||
// Set default rate limit value for testing
|
||||
const PRO_PASSES = process.env.PRO_PASSES ? process.env.PRO_PASSES : 'testpassword'
|
||||
const PRO_PASSES = process.env.PRO_PASS
|
||||
? process.env.PRO_PASS
|
||||
: 'testpassword'
|
||||
// Convert the pro-tier password string into an array split by ':'.
|
||||
const PRO_PASS = PRO_PASSES.split(':')
|
||||
|
||||
@@ -47,6 +49,8 @@ class AuthMW {
|
||||
// Initialize passport for 'anonymous' authentication.
|
||||
passport.use(new AnonymousStrategy())
|
||||
|
||||
console.log(`PRO_PASS: ${JSON.stringify(PRO_PASS, null, 2)}`)
|
||||
|
||||
// Initialize passport for 'basic' authentication.
|
||||
passport.use(
|
||||
new BasicStrategy({ passReqToCallback: true }, function (
|
||||
|
||||
@@ -154,9 +154,11 @@ class RateLimits {
|
||||
|
||||
// For internal calls, increase rate limits to as fast as possible.
|
||||
if (
|
||||
key.toString().indexOf('172.17.') > -1
|
||||
// Comment out the line below when running bch-js e2e rate limit tests.
|
||||
// key.toString().indexOf('::ffff:127.0.0.1') > -1
|
||||
key.toString().indexOf('::ffff:127.0.0.1') > -1 ||
|
||||
|
||||
// Do not comment out this line.
|
||||
key.toString().indexOf('172.17.') > -1
|
||||
) {
|
||||
pointsToConsume = 1
|
||||
res.locals.pointsToConsume = pointsToConsume // Feedback for tests.
|
||||
|
||||
Reference in New Issue
Block a user