Show More
@@ -182,6 +182,7 b' class HTTPApplication(object):' | |||||
182 | name='msgpack', |
|
182 | name='msgpack', | |
183 | factory=self._msgpack_renderer_factory) |
|
183 | factory=self._msgpack_renderer_factory) | |
184 |
|
184 | |||
|
185 | self.config.add_route('service', '/_service') | |||
185 | self.config.add_route('status', '/status') |
|
186 | self.config.add_route('status', '/status') | |
186 | self.config.add_route('hg_proxy', '/proxy/hg') |
|
187 | self.config.add_route('hg_proxy', '/proxy/hg') | |
187 | self.config.add_route('git_proxy', '/proxy/git') |
|
188 | self.config.add_route('git_proxy', '/proxy/git') | |
@@ -191,6 +192,9 b' class HTTPApplication(object):' | |||||
191 |
|
192 | |||
192 | self.config.add_view( |
|
193 | self.config.add_view( | |
193 | self.status_view, route_name='status', renderer='json') |
|
194 | self.status_view, route_name='status', renderer='json') | |
|
195 | self.config.add_view( | |||
|
196 | self.service_view, route_name='service', renderer='msgpack') | |||
|
197 | ||||
194 | self.config.add_view(self.hg_proxy(), route_name='hg_proxy') |
|
198 | self.config.add_view(self.hg_proxy(), route_name='hg_proxy') | |
195 | self.config.add_view(self.git_proxy(), route_name='git_proxy') |
|
199 | self.config.add_view(self.git_proxy(), route_name='git_proxy') | |
196 | self.config.add_view( |
|
200 | self.config.add_view( | |
@@ -249,6 +253,19 b' class HTTPApplication(object):' | |||||
249 | def status_view(self, request): |
|
253 | def status_view(self, request): | |
250 | return {'status': 'OK'} |
|
254 | return {'status': 'OK'} | |
251 |
|
255 | |||
|
256 | def service_view(self, request): | |||
|
257 | import vcsserver | |||
|
258 | payload = msgpack.unpackb(request.body, use_list=True) | |||
|
259 | resp = { | |||
|
260 | 'id': payload.get('id'), | |||
|
261 | 'result': dict( | |||
|
262 | version=vcsserver.__version__, | |||
|
263 | config={}, | |||
|
264 | payload=payload, | |||
|
265 | ) | |||
|
266 | } | |||
|
267 | return resp | |||
|
268 | ||||
252 | def _msgpack_renderer_factory(self, info): |
|
269 | def _msgpack_renderer_factory(self, info): | |
253 | def _render(value, system): |
|
270 | def _render(value, system): | |
254 | value = msgpack.packb(value) |
|
271 | value = msgpack.packb(value) |
General Comments 0
You need to be logged in to leave comments.
Login now