##// END OF EJS Templates
channelstream: try to use proxy url's unless ws urls are not explictly defined
ergo -
r813:da2b7294 default
parent child Browse files
Show More
@@ -420,7 +420,9 b' channelstream.server = 127.0.0.1:9800'
420 ## location of the channelstream server from outside world
420 ## location of the channelstream server from outside world
421 ## most likely this would be an http server special backend URL, that handles
421 ## most likely this would be an http server special backend URL, that handles
422 ## websocket connections see nginx example for config
422 ## websocket connections see nginx example for config
423 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
423 # channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
424 ## proxy path that can be used by http daemons for exposing channelstream
425 # channelstream.proxy_path = /_channelstream
424 channelstream.secret = secret
426 channelstream.secret = secret
425 channelstream.history.location = %(here)s/channelstream_history
427 channelstream.history.location = %(here)s/channelstream_history
426
428
@@ -394,7 +394,9 b' channelstream.server = 127.0.0.1:9800'
394 ## location of the channelstream server from outside world
394 ## location of the channelstream server from outside world
395 ## most likely this would be an http server special backend URL, that handles
395 ## most likely this would be an http server special backend URL, that handles
396 ## websocket connections see nginx example for config
396 ## websocket connections see nginx example for config
397 channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
397 # channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
398 ## proxy path that can be used by http daemons for exposing channelstream
399 # channelstream.proxy_path = /_channelstream
398 channelstream.secret = secret
400 channelstream.secret = secret
399 channelstream.history.location = %(here)s/channelstream_history
401 channelstream.history.location = %(here)s/channelstream_history
400
402
@@ -27,11 +27,15 b' from rhodecode.lib.ext_json import json'
27
27
28
28
29 def url_gen(request):
29 def url_gen(request):
30 registry = request.registry
31 longpoll_url = registry.settings.get('channelstream.longpoll_url', '')
32 ws_url = registry.settings.get('channelstream.ws_url', '')
33 proxy_url = request.route_url('channelstream_proxy')
30 urls = {
34 urls = {
31 'connect': request.route_url('channelstream_connect'),
35 'connect': request.route_path('channelstream_connect'),
32 'subscribe': request.route_url('channelstream_subscribe'),
36 'subscribe': request.route_path('channelstream_subscribe'),
33 'longpoll': request.registry.settings.get('channelstream.longpoll_url', ''),
37 'longpoll': longpoll_url or proxy_url,
34 'ws': request.registry.settings.get('channelstream.ws_url', '')
38 'ws': ws_url or proxy_url.replace('http', 'ws')
35 }
39 }
36 return json.dumps(urls)
40 return json.dumps(urls)
37
41
@@ -78,4 +82,7 b' def includeme(config):'
78 config.add_route(
82 config.add_route(
79 name='channelstream_subscribe',
83 name='channelstream_subscribe',
80 pattern=ADMIN_PREFIX + '/channelstream/subscribe')
84 pattern=ADMIN_PREFIX + '/channelstream/subscribe')
85 config.add_route(
86 name='channelstream_proxy',
87 pattern=settings.get('channelstream.proxy_path') or '/_channelstream')
81 config.scan('rhodecode.channelstream')
88 config.scan('rhodecode.channelstream')
General Comments 0
You need to be logged in to leave comments. Login now