Use internal url for chat

This commit is contained in:
James Allen 2014-07-17 11:43:12 +01:00
parent 8d946e68d2
commit e0f1ed3c10
3 changed files with 7 additions and 6 deletions

View file

@ -10,7 +10,7 @@ module.exports =
json: json:
content:messageContent content:messageContent
user_id:user_id user_id:user_id
uri:"#{settings.apis.chat.url}/room/#{project_id}/messages" uri:"#{settings.apis.chat.internal_url}/room/#{project_id}/messages"
request opts, (err, response, body)-> request opts, (err, response, body)->
if err? if err?
logger.err err:err, "problem sending new message to chat" logger.err err:err, "problem sending new message to chat"
@ -24,7 +24,7 @@ module.exports =
qs.before = query.before if query?.before? qs.before = query.before if query?.before?
opts = opts =
uri:"#{settings.apis.chat.url}/room/#{project_id}/messages" uri:"#{settings.apis.chat.internal_url}/room/#{project_id}/messages"
method:"get" method:"get"
qs: qs qs: qs

View file

@ -88,6 +88,7 @@ module.exports =
subdomain: "" subdomain: ""
chat: chat:
url: "http://localhost:3010" url: "http://localhost:3010"
internal_url: "http://localhost:3010"
templates: templates:
port: 3007 port: 3007
user_id: process.env.TEMPLATES_USER_ID or "5395eb7aad1f29a88756c7f2" user_id: process.env.TEMPLATES_USER_ID or "5395eb7aad1f29a88756c7f2"

View file

@ -13,7 +13,7 @@ describe "ChatHandler", ->
@settings = @settings =
apis: apis:
chat: chat:
url:"chat.sharelatex.env" internal_url:"chat.sharelatex.env"
@request = sinon.stub() @request = sinon.stub()
@ChatHandler = SandboxedModule.require modulePath, requires: @ChatHandler = SandboxedModule.require modulePath, requires:
"settings-sharelatex":@settings "settings-sharelatex":@settings
@ -38,7 +38,7 @@ describe "ChatHandler", ->
json: json:
content:@messageContent content:@messageContent
user_id:@user_id user_id:@user_id
uri:"#{@settings.apis.chat.url}/room/#{@project_id}/messages" uri:"#{@settings.apis.chat.internal_url}/room/#{@project_id}/messages"
@request.calledWith(@opts).should.equal true @request.calledWith(@opts).should.equal true
done() done()
@ -59,7 +59,7 @@ describe "ChatHandler", ->
@ChatHandler.getMessages @project_id, @query, (err)=> @ChatHandler.getMessages @project_id, @query, (err)=>
@opts = @opts =
method:"get" method:"get"
uri:"#{@settings.apis.chat.url}/room/#{@project_id}/messages" uri:"#{@settings.apis.chat.internal_url}/room/#{@project_id}/messages"
qs:{} qs:{}
@request.calledWith(@opts).should.equal true @request.calledWith(@opts).should.equal true
done() done()
@ -70,7 +70,7 @@ describe "ChatHandler", ->
@ChatHandler.getMessages @project_id, @query, (err)=> @ChatHandler.getMessages @project_id, @query, (err)=>
@opts = @opts =
method:"get" method:"get"
uri:"#{@settings.apis.chat.url}/room/#{@project_id}/messages" uri:"#{@settings.apis.chat.internal_url}/room/#{@project_id}/messages"
qs: qs:
limit:5 limit:5
before:12345 before:12345