##// END OF EJS Templates
service-endpoint: expose additional data of vcsserver via service-data endpoint....
marcink -
r173:d7a24340 default
parent child Browse files
Show More
@@ -153,8 +153,10 b' class HTTPApplication(object):'
153 remote_wsgi = remote_wsgi
153 remote_wsgi = remote_wsgi
154 _use_echo_app = False
154 _use_echo_app = False
155
155
156 def __init__(self, settings=None):
156 def __init__(self, settings=None, global_config=None):
157 self.config = Configurator(settings=settings)
157 self.config = Configurator(settings=settings)
158 self.global_config = global_config
159
158 locale = settings.get('locale', '') or 'en_US.UTF-8'
160 locale = settings.get('locale', '') or 'en_US.UTF-8'
159 vcs = VCS(locale=locale, cache_config=settings)
161 vcs = VCS(locale=locale, cache_config=settings)
160 self._remotes = {
162 self._remotes = {
@@ -273,12 +275,26 b' class HTTPApplication(object):'
273
275
274 def service_view(self, request):
276 def service_view(self, request):
275 import vcsserver
277 import vcsserver
278 import ConfigParser as configparser
279
276 payload = msgpack.unpackb(request.body, use_list=True)
280 payload = msgpack.unpackb(request.body, use_list=True)
281
282 try:
283 path = self.global_config['__file__']
284 config = configparser.ConfigParser()
285 config.read(path)
286 parsed_ini = config
287 if parsed_ini.has_section('server:main'):
288 parsed_ini = dict(parsed_ini.items('server:main'))
289 except Exception:
290 log.exception('Failed to read .ini file for display')
291 parsed_ini = {}
292
277 resp = {
293 resp = {
278 'id': payload.get('id'),
294 'id': payload.get('id'),
279 'result': dict(
295 'result': dict(
280 version=vcsserver.__version__,
296 version=vcsserver.__version__,
281 config={},
297 config=parsed_ini,
282 payload=payload,
298 payload=payload,
283 )
299 )
284 }
300 }
@@ -404,5 +420,5 b' def main(global_config, **settings):'
404 if MercurialFactory:
420 if MercurialFactory:
405 hgpatches.patch_largefiles_capabilities()
421 hgpatches.patch_largefiles_capabilities()
406 hgpatches.patch_subrepo_type_mapping()
422 hgpatches.patch_subrepo_type_mapping()
407 app = HTTPApplication(settings=settings)
423 app = HTTPApplication(settings=settings, global_config=global_config)
408 return app.wsgi_app()
424 return app.wsgi_app()
General Comments 0
You need to be logged in to leave comments. Login now