From ed4fdd48d771a746148963e3d069451d0db168e6 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 5 May 2016 16:50:18 +0100 Subject: [PATCH] clsi cookies are given an expire time via settings file --- .../web/app/coffee/Features/Compile/ClsiCookieManager.coffee | 3 +-- .../UnitTests/coffee/Compile/ClsiCookieManagerTests.coffee | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/web/app/coffee/Features/Compile/ClsiCookieManager.coffee b/services/web/app/coffee/Features/Compile/ClsiCookieManager.coffee index ad8c908cee..9827e328b4 100644 --- a/services/web/app/coffee/Features/Compile/ClsiCookieManager.coffee +++ b/services/web/app/coffee/Features/Compile/ClsiCookieManager.coffee @@ -10,7 +10,6 @@ buildKey = (project_id)-> clsiCookiesEnabled = Settings.clsiCookieKey? and Settings.clsiCookieKey.length != 0 -ONE_WEEK_IN_SECONDS = 60 * 60 * 24 * 7 module.exports = ClsiCookieManager = @@ -45,7 +44,7 @@ module.exports = ClsiCookieManager = serverId = ClsiCookieManager._parseServerIdFromResponse(response) multi = rclient.multi() multi.set buildKey(project_id), serverId - multi.expire buildKey(project_id), ONE_WEEK_IN_SECONDS + multi.expire buildKey(project_id), Settings.clsi_cookie_expire_length multi.exec (err)-> callback(err, serverId) diff --git a/services/web/test/UnitTests/coffee/Compile/ClsiCookieManagerTests.coffee b/services/web/test/UnitTests/coffee/Compile/ClsiCookieManagerTests.coffee index 28dad51d8b..f40078a1d2 100644 --- a/services/web/test/UnitTests/coffee/Compile/ClsiCookieManagerTests.coffee +++ b/services/web/test/UnitTests/coffee/Compile/ClsiCookieManagerTests.coffee @@ -30,6 +30,7 @@ describe "ClsiCookieManager", -> apis: clsi: url: "http://clsi.example.com" + clsi_cookie_expire_length: Math.random() clsiCookieKey: "coooookie" @requires = "redis-sharelatex" : @@ -89,7 +90,7 @@ describe "ClsiCookieManager", -> it "should set the server id with a ttl", (done)-> @ClsiCookieManager.setServerId @project_id, @response, (err)=> @redisMulti.set.calledWith("clsiserver:#{@project_id}", "clsi-8").should.equal true - @redisMulti.expire.calledWith("clsiserver:#{@project_id}", 60 * 60 * 24 * 7).should.equal true + @redisMulti.expire.calledWith("clsiserver:#{@project_id}", @settings.clsi_cookie_expire_length).should.equal true done() it "should return the server id", (done)->