mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -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 =
|
||||
|
||||
|
|
|
@ -9,17 +9,26 @@ SandboxedModule = require('sandboxed-module')
|
|||
describe "FileStoreHandler", ->
|
||||
|
||||
beforeEach ->
|
||||
@settings = apis:{filestore:{url:"http//filestore.sharelatex.test"}}
|
||||
@settings =
|
||||
redis:
|
||||
web:
|
||||
port:"1234"
|
||||
host:"somewhere"
|
||||
password: "password"
|
||||
@redbackInstance =
|
||||
addCount: sinon.stub()
|
||||
|
||||
@redback =
|
||||
createRateLimit: sinon.stub().returns(@redbackInstance)
|
||||
@redis =
|
||||
createClient: ->
|
||||
return auth:->
|
||||
|
||||
@limiter = SandboxedModule.require modulePath, requires:
|
||||
"settings-sharelatex":@settings
|
||||
"logger-sharelatex" : @logger = {log:sinon.stub(), err:sinon.stub()}
|
||||
"redback": createClient: => @redback
|
||||
"redis": @redis
|
||||
"redback": use: => @redback
|
||||
|
||||
@endpointName = "compiles"
|
||||
@subject = "some project id"
|
||||
|
|
Loading…
Reference in a new issue