##// 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 420 ## location of the channelstream server from outside world
421 421 ## most likely this would be an http server special backend URL, that handles
422 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 426 channelstream.secret = secret
425 427 channelstream.history.location = %(here)s/channelstream_history
426 428
@@ -394,7 +394,9 b' channelstream.server = 127.0.0.1:9800'
394 394 ## location of the channelstream server from outside world
395 395 ## most likely this would be an http server special backend URL, that handles
396 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 400 channelstream.secret = secret
399 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 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 34 urls = {
31 'connect': request.route_url('channelstream_connect'),
32 'subscribe': request.route_url('channelstream_subscribe'),
33 'longpoll': request.registry.settings.get('channelstream.longpoll_url', ''),
34 'ws': request.registry.settings.get('channelstream.ws_url', '')
35 'connect': request.route_path('channelstream_connect'),
36 'subscribe': request.route_path('channelstream_subscribe'),
37 'longpoll': longpoll_url or proxy_url,
38 'ws': ws_url or proxy_url.replace('http', 'ws')
35 39 }
36 40 return json.dumps(urls)
37 41
@@ -78,4 +82,7 b' def includeme(config):'
78 82 config.add_route(
79 83 name='channelstream_subscribe',
80 84 pattern=ADMIN_PREFIX + '/channelstream/subscribe')
85 config.add_route(
86 name='channelstream_proxy',
87 pattern=settings.get('channelstream.proxy_path') or '/_channelstream')
81 88 config.scan('rhodecode.channelstream')
General Comments 0
You need to be logged in to leave comments. Login now