added redis connection settings into rate limiter

This commit is contained in:
Henry Oswald 2014-03-03 11:46:40 +00:00
parent ff8320bce0
commit dd22f1f7a1
2 changed files with 16 additions and 3 deletions

View file

@ -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 =

View file

@ -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"