mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
added redis connection settings into rate limiter
This commit is contained in:
parent
ff8320bce0
commit
dd22f1f7a1
2 changed files with 16 additions and 3 deletions
|
@ -1,4 +1,8 @@
|
||||||
redback = require("redback").createClient()
|
settings = require("settings-sharelatex")
|
||||||
|
redis = require('redis')
|
||||||
|
rclient = redis.createClient(settings.redis.web.port, settings.redis.web.host)
|
||||||
|
rclient.auth(settings.redis.web.password)
|
||||||
|
redback = require("redback").use(rclient)
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
|
|
||||||
|
|
|
@ -9,17 +9,26 @@ SandboxedModule = require('sandboxed-module')
|
||||||
describe "FileStoreHandler", ->
|
describe "FileStoreHandler", ->
|
||||||
|
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@settings = apis:{filestore:{url:"http//filestore.sharelatex.test"}}
|
@settings =
|
||||||
|
redis:
|
||||||
|
web:
|
||||||
|
port:"1234"
|
||||||
|
host:"somewhere"
|
||||||
|
password: "password"
|
||||||
@redbackInstance =
|
@redbackInstance =
|
||||||
addCount: sinon.stub()
|
addCount: sinon.stub()
|
||||||
|
|
||||||
@redback =
|
@redback =
|
||||||
createRateLimit: sinon.stub().returns(@redbackInstance)
|
createRateLimit: sinon.stub().returns(@redbackInstance)
|
||||||
|
@redis =
|
||||||
|
createClient: ->
|
||||||
|
return auth:->
|
||||||
|
|
||||||
@limiter = SandboxedModule.require modulePath, requires:
|
@limiter = SandboxedModule.require modulePath, requires:
|
||||||
"settings-sharelatex":@settings
|
"settings-sharelatex":@settings
|
||||||
"logger-sharelatex" : @logger = {log:sinon.stub(), err:sinon.stub()}
|
"logger-sharelatex" : @logger = {log:sinon.stub(), err:sinon.stub()}
|
||||||
"redback": createClient: => @redback
|
"redis": @redis
|
||||||
|
"redback": use: => @redback
|
||||||
|
|
||||||
@endpointName = "compiles"
|
@endpointName = "compiles"
|
||||||
@subject = "some project id"
|
@subject = "some project id"
|
||||||
|
|
Loading…
Reference in a new issue